How to convert multiple images in to separate layers in one EPS file using ImageMagick? - imagemagick

I have set of multiple images, which I need to merge in to one eps file as separate layer. Is it possible via ImageMagick? how?

You can overlay images with the -composite command, you can give it at shot:
$ convert image1.jpg image2.jpg ... imageN.jpg -composite output.esp
See https://imagemagick.org/script/composite.php

Related

Image magic convert command creates more than one file

I executed below command to convert a .tif file to a .jpg file. But for some tif images it generates 3 jpg files when only one file is expected. One is the expected jpg file, one is the same image in a black background and the other is just a white image.
magick convert /<.tif image name> -intent relative -resize 1500x1500> -quality 95 -colorspace sRGB -strip -auto-orient /<output .jpg image name>
Does anyone know the reason for this? what property of the input file causing this? or is there a issue with the command?
magick convert /<.tif image> -intent relative -resize 1500x1500> -quality 95 -colorspace sRGB -strip -auto-orient /<output .jpg image>
Expect this to give a single jpg image. But it gives 3 images for some input .tif images
Just adding some meat to #GeeMack's comment...
TIFF files often contain multiple images - or IFDs as referred to in the documentation. These can represent many things, but the most common are:
a low-resolution, flattened preview image followed by a full-resolution image aimed at providing quick previews
multiple pages of longer documents
colour separations for printing
the many channels of multi/hyper-spectral images
the layers of a multi-layer images, e.g. Photoshop editing layers
images and their associated masks, or classes/categories/classifications
... and so on.
A quick way to check what you have is with ImageMagick's identify command as that will produce a line for each image in the file, and you can often tell by the sizes, shapes and types of the layers which is a small preview and which is high resolution image, or that there are 242 channels of identical resolution images for a EO-1 hyperspectral imager.
magick identify IMAGE.TIF
Here's an example:
magick identify Prokudin-Gorskii.tif
Prokudin-Gorskii.tif[0] TIFF 3702x3205 3702x3205+0+0 16-bit sRGB 134.955MiB 0.060u 0:00.064
Prokudin-Gorskii.tif[1] TIFF 3702x3205 3702x3205+0+0 16-bit sRGB 134.955MiB 0.000u 0:00.001
Prokudin-Gorskii.tif[2] TIFF 625x175 625x175+841+814 16-bit sRGB 134.955MiB 0.000u 0:00.001
and you can see from the sizes that there are two full layers followed by a reduced size layer that is only annotation or markup on a small area of the image.
Another useful technique is to lay out all the images within a TIFF beside each other in a row across the page, with 10 pixel gaps between, using a command like this:
magick IMAGE.TIFF +smush 10 contents.jpg
We can now see that the three layers in the foregoing image correspond to a flattened version of all the layers on the left, followed by the two individual layers themselves in the centre and the reduced size yellow line overlay layer on the right.
If we then determine that it is only the first, flattened image we are interested in, we can extract and manipulate that alone by adding its sequence number in square brackets afterwards. So, to extract just the first flattened image:
magick IMAGE.TIF[0] extracted.tif
You can also extract multiple individual images and ranges, using commas and dashes.
Note also that magick convert is generally not what you want.
Note also that exiftool is lighter weight than a full ImageMagick installation and can also tell you what's in a multi-IFD TIFF.

Missing layer when Combining images into PSD using ImageMagick

I'm trying to combine 3 images using imageMagicks 7 latest version however the first layer is always missing.
convert "image_03.png" "image_02.png" "image_01.png" -background none -alpha set "product.psd"
However i only get two layers??
Attached are the images below ...
A PSD file expects a layer that is the flattened layer from all the other layers. It needs to be the first layer. Photoshop assumes the first layer is the flattened layer. It must be created in Imagemagick and combined with the other individual layers as the first image in the command sequence when writing a PSD file. So I create it last from clones and then insert it at the first position (0).
Try the following.
Unix syntax:
convert "image_03.png" "image_02.png" "image_01.png" \( -clone 0-2 -flatten \) -insert 0 -background none -alpha set "product.psd"
If on Windows, remove the \s from in front of the parentheses.
Reorder the images as desired for the layers in the PSD file.

ImageMagick v7 conversion of 8bpp images

On Windows 10, I need to crop and resize whole folders of images.
Following the documentation and some answers here i've built this batch:
magick mogrify -path ./cropped -crop 1300x1940+85+130 +repage -resize "800x800^" *.jpg
It mostly works, but when a folder has mixed image formats (some are 24bpp, some are 8bpp, grayscale) this batch skips all the 8bpp ones.
How can i change my command so it accepts and modify every image, no matter what?
Note: i used mogrify as i understand it is needed to process a whole folder and save the result in another one, but i'm unsure it is necessary.

Using ImageMagick I need to splice half of two images into a new image

I am trying to figure out the best way to do this, since I need to create a script that will complete this task for about 3000 image files. So, I have two sets of images and I want to create two more sets. The object is to take the left vertical half of image A and combine it with the right half of image B, creating set AB. I will also need to do the opposite and create set BA, which would be the forth set. I need to do this in a way such that it continues the naming convention for the files, which have names like name.001.jpg. Any help will be much appreciated.
Here is an example of how to do that in ImageMagick Unix syntax for two images.
Image1:
Image2:
convert logo.jpg logo_b5.jpg -crop 50x100% \( -clone 0,3 +append +write logo_A.jpg \) \( -clone 2,1 +append +write logo_B.jpg \) null:
logo_A.jpg
logo_B.jpg
Please explain where your two sets of data are stored and how they are named. For multiple pairs of images, you will need to write a loop assuming you have each set with the same name in two different folders. But you need to say what OS you are using since Windows bat scripting is different from Unix shell scripting.

ImageMagick: montaging image from different-sized tiles

I'm developing a script to download images from tile-based image-hosting.
I downloaded tiles using wget and trying to use montage to compine them.
The problem is that I've got tiles with different sizes (last tile in row is more narrow than the others). Here is combine command:
montage $temp/*.jpg -tile $maxcolumn"x"$maxrow -geometry -1-1 -quality 100% merged.jpg
ImageMagick aligns tiles by grid and produces this image (see right and bottom sides).
image http://leftparagraphs.ru/!/merged.jpg
How do I fix this with montage?
Fixed by specifying "-mode Concatenate".
Also I have to run another instance of convert after montage to "-trim" resulting image.
This solution did not work for me. To combine two different height images into one, I first used the identify command to get the height of the largest image (1280 pixels):
identify large.jpg
Then I used the following command to resize the smaller image and combine it side by side with the larger one:
montage -tile 2x1 -geometry +0+0 small.jpg"[x1280]" large.jpg output.jpg

Resources