Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Why I do that is I want to resize image.jpg while keeping aspect ratio to a max 1280x1280, but if I enter -resize 1280x1280 than the overlay.jpg gets cropped, and I want the overlay.jpg to resized to fit the smallest side.
With two lines it's easy, but I have no clue how to go about it in one.
kosmarnik wrote: ↑2017-04-03T13:11:53-07:00Why I do that is I want to resize image.jpg while keeping aspect ratio to a max 1280x1280, but if I enter -resize 1280x1280 than the overlay.jpg gets cropped, and I want the overlay.jpg to resized to fit the smallest side.
A command like this will resize your first image, maintaining its aspect, to make it fit inside a 1280x1280 space. Then it sets a variable by obtaining the width or height, whichever is smaller, from the resized input image. Then it resizes your overlay image to fit inside the space specified by that variable while also retaining its aspect...
Adjust your "-profile" and "-define" settings as needed. If you're working on a *nix shell or script, you'll have to change that continued line caret "^" to a backslash "\", and also escape those parentheses with backslashes "\( ... \)". If you're using it in a Windows BAT script you'll have to make all the single percent marks "%" into doubles "%%".
Just to be clear, since you did not say what version of IM you are using nor what platform, to do what snibgo and GeeMack suggest requires IM 7. If you are on IM 6, you cannot do this and would need two lines
Indeed, it was late and I missed the quoted parentheses at first, they don't have to be escaped
Another weird thing is windows Perl and system calls, I could not for the life of me escape the % signs, but that's for another forum. Got around it by switching to cygwin Perl.