How to Join images of different size - adding Footer Image to all images (BULK) - image

I have more than 8000 images of different dimensions.
I want my footer image to adjust its width according to each image size and join the image at the bottom.
I am a basic person and will not be able to program it myself.
Is there any software that will help me do this?

You could use ImageMagick, which is installed on most Linux distros and available for OS X, all good OSes and Windows from here.
So, if you have an image like this:
the code to add a label would be pretty easy like this:
convert image.jpg -gravity center -background lime -fill yellow -stroke black -pointsize 36 label:"My Photo" -append result.jpg
I am not suggesting that is a good colour scheme, I am just showing you how/where to set the colours, and you can change them as you wish. If you now run the same code on a different size image like this:
you will get this:
There are countless examples here.
Please copy some of your images to a test folder and practice with the code below in there so you don't mess up your original photos. As I said, I don't really "do" Windows, but the code will look like this to do all the PNG and JPG files in a directory:
for %a in (*.PNG *.JPG) do convert "%a" -gravity center -background lime -fill yellow -stroke black -pointsize 36 label:"My Photo" -append "%a"
There are some good examples of using FOR loops here.

You can try Irfanview it has the paste special option that will resize and paste your footer image below the original one in one shot. But unfortunately it can't do it for you for the 8000 images.
To resize + merge a footer: Open your footer image, copy it (ctrl+c)
Now open your original image in IrfanView, go to Edit -> Paste Special -> to Bottom, it will resize & merge your footer under the original image.
IrfanView has also a batch conversion option to resize images in bulk but it can't join your images automatically. So it will help you with the resizing if needed.
To open the batch conversion in IrfanView, go to File -> Batch conversion/rename -> Advanced
From here you have tons of stuff to do among which the batch resize

Related

Capture an image from a USB camera and display it in the monitor

I'm trying to make an embedded-linux application that takes an image from a USB camera, write something on this image (boxes and text) and display the modified image in the monitor.
I see there are lot of frameworks and tools to do this, but I'm not sure what would be the best approach in this case, and I would love to have some directions in case someone has an advice. I was planing to use C++ but I could use be flexible on this.
Thanks
Gus
You will need to get Video4Linux working anyway because OpenCV uses that underneath to acquire images, so you could use that to grab the image(s). You could then add text and boxes very simply with ImageMagick and that could be done from command-line with no programming required. You could then display them with feh or ImageMagick's display program, or any X11 viewer.
Let's say you acquired this image:
You could annotate it like this in a bash script at the command line:
convert input.png \
-fill none -stroke lime -draw "rectangle 10,50 200,300" \
-fill white -undercolor '#00000080' -gravity SouthEast -pointsize 72 -annotate +0+5 ' Funky Annotation ' result.png
OpenCV can take a lot of configuring and a long time to compile. You could add text and boxes in OpenCV but the fonts are not very configurable in OpenCV because it is more oriented towards Computer Vision (i.e. identifying objects and faces) rather generating and annotating images.
Your question is actually rather too broad for this site. Do you actually mean a single image, or a video? What sort of annotations do you mean? Is there a target frame-rate?

Copyright/Watermark many images with different resolutions (with ImageMagick)

i am trying to solve the following problem:
I have one picture logo.png with a resolution of 1260x1580. I want to use this to copyright different JPG-Images, e.g. image1.jpg with a resolution of 1280x853. I want to have the logo e.g. at the bottom right and always with a height of e.g. 1/8 of the height of the JPG-Image.
Short: I have many images with different resolutions and the copyright should have always the same proportion (e.g. 1/8 of the total heigth) within that image.
I am using ImageMagick on command-line (on Windows 10), at the moment like this:
magick image1.jpg logo.png -resize x%[fx:u.h/8] -gravity SouthEast -geometry +15+15 -composite outfile.jpg
Unfortunately the resize-Option with x%[fx:u.h/8] doesn't work like expected, it also resizes the JPG-Image image1.jpg. I don't know, how i can manage it to resize only the logo.png and let the size of image1.jpg untouched. When i put ( logo.png -resize x%[fx:u.h/4] ) in brackets of course u.h then refers to logo.png, this is also wrong :-/
It would be great if you can assist me a little bit to find the right command for my purpose... Thanks for your replies and help!
PS: I hope that i didn't ignored some important source or help, but i can't find the solution by myself - sorry.
You have a stack of two images, the main input and the logo. You can have your "-resize" operation work on just the logo by adding a condition to the FX expression. Start your command with something like this...
magick image1.jpg logo.png -resize x%[fx:t==1?u[0].h/8:u[0].h] ...
The expression runs once for each image in the stack. The "t" substitutes for the position of the image in the stack, the first image is 0, the second is 1. So if "t" equals 1, it's the logo. Resize it to 1/8 the height of the first image indicated by "u[0].h/8". Otherwise resize it to "u[0].h", which is already the height of the first image, so it won't change that one.
In Imagemagick, try simply using parenthesis to limit the operation
magick image1.jpg ( logo.png -resize x%[fx:u.h/8] ) -gravity SouthEast -geometry +15+15 -composite outfile.jpg

Transparent PNG created in Imagemagick drawn as opaque in FFMPEG

I am trying to script the creation of videos using ImageMagick to create some overlays which are then placed on top of a video.
If I try to use the image created by ImageMagick directly the transparency is drawn as opaque.
I have created a transparent PNG using ImageMagick draw commands. When loaded into GIMP and examined, the PNG has an alpha channel and each transparent pixel appears to have transparency: RGBA = 0,0,0,0
This image when then used as an overlay in ffmpeg just has an opaque black background in the video.
If I export the image again from GIMP then the file looks identical, but in the video just appears as a solid blue (the colour of the drawings in the overlay image).
I can fix this by taking the overlay image, loading it in GIMP and then selecting all and creating a new image from the clipboard and exporting that (using exactly the same settings as when I re-exported before without creating a new file) and it will then work exactly as desired, showing the non-transparent portions of the overlay and not showing transparent parts.
KEY QUESTION:
How can I either script the conversion that somehow occurs when creating a new file in GIMP, or (much better) not have it go wrong in the first place?
Here are the two files:
BROKEN:
WORKS:
What is the difference?
I suggest you prefix the output filename when using ImageMagick with PNG32: to force it to generate a 32-bit ber pixel image - i.e. 1 byte each for R, G, B and Alpha and hope that ffmpeg is happier with that.
convert input.png -draw ... PNG32:output.png
If you run identify -verbose (also in the ImageMagick suite) on your broken and your working images, you will see that the primary difference is that the working image has color-type=6 and bit-depth=8 whereas the broken image has color-type=3 (indexed) and bit-depth=4

Need a tool to set multiple image backgrounds to transparent

I'm searching for a software/tool to set the image background (black) to transparent.
I want to to remove all the black and make the image transparent.
All the images are .PNG and I have around 191 hence why I need a tool to do multiple images otherwise it could take me a very long time.
Use either graphicsmagick or imagemagick mogrify tool with the -transparent black option. When I ran it on your single sample image it looked like this:
gm mogrify -transparent black 'sprite sheet 4.png'
To do a few hundred of these, you'd use it like this:
for f in *.png ; do gm mogrify -transparent black "$f" ; done
Be sure to work on copies of the files -- mogrify modifies files "in place".

How to edit an PNG image per pixel via cli?

Say I have an PNG image where I want to change certain pixels to, say, black. How would I do that?
My guess is that I should take the ImageMagick route. But how would I change, say, pixel ten from the top and from the left to black? To, say, 2% grey etc?
EDIT: Since the comment field doesn´t work for code, this addition is directed to eduffys answer:
Thanks. That lead me some of the way, after correcting the syntax. But it doesn´t work quite yes, as I can´t set the colour.
convert foo.png -draw ‘color 10,10 point’ foo1.png
works, painting the pixel black
convert foo.png -draw ‘#cc9999 color 10,10 point’ foo1.png
Does not return an error but doesn´t do anything visible to the file
convert foo.png -draw ‘color #cc9999 10,10 point’ foo1.png
Give me an error message.
You could combine either convert or mogrify with the -draw switch and the point command.
Something like this (not tested)
mogrify foo.png -draw 'color 020202 point 10,10'
If you don't mind using php script, you can take a look on:
php graphic.
That way you can execute the script:
# php add_watermark.php myimage.png
Previous link has watermark examples too.
You can choose to reeplace the image, or to redirect the output to a file (remember removing HTTP headers).
# php add_watermark.php myimage.png > myimage.wm.png
Good luck,

Resources