How to make reflected Image thumbnails

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?".
richo

Re: How to make reflected Image thumbnails

Post by richo »

I just have .bat script in windows. I do not do building images online as my provider do not have imagemagick in php only db2.
Can you ask imagemagick to return (in batch file) some info about image (dimensions?)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to make reflected Image thumbnails

Post by anthony »

Making it size dependant is a bit of a problem at the moment, as you can not use other image dimentions to set settings like -size. At least not yet. I have ideas about implementing it where you can use percent escapes, but backward compatibility is a problem ,as well as confusion about when the percent escape is actually substituted into the option setting.


If you can get the size of the final image into some variables you can then generate
a gradient at that size and then adjust the gradient image appropriatally.

Remember though we are not here to do your work for you, just give you pointers an clues on how to do it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to make reflected Image thumbnails

Post by Bonzo »

A few months ago I seem to remember you posting some way of using FX to set an image size Anthony.

Something like "convert original_image -size FX w h" and this will give you a canvas the same size as the original_image?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to make reflected Image thumbnails

Post by anthony »

-fx always produces an image the same size as the first image. That is its nature.

The other ways to make a different sized image is to scale, do the calculations yourself.

Best idea... scale the original image, the use -fx to set up a basic linear gradient.

Code: Select all

convert image.png +matte -scale 100x20% -fx 'j/(h-1)'  gradient.png
OR closer to what you are after, copy the original image crop it then add
a linear gradient transparency directly. I'll even do the cloning, transparency level and appending for you. Only a distortion is needed the result and overlay on a background.

Code: Select all

convert image.png -matte  \
            \( +clone -flip -crop 100x20%+0+0 \
               -channel A -fx '1-j/(h-1)'  -evaluate multiply .3  \) \
           -append  ...add_distort_here...
          -bordercolor silver -border 10  reflected_image.png
NOTE: shortly a 3d rotation (a perspective variant) distort method will be available, which will mean you will not need to specify image size dependent coordinates to do the perspective distortion. The rotation algorithm is courtesy of Fred Weinhaus's 3d rotate scripts, and is being added to IM development sources in the next few days. See http://www.fmwconcepts.com/imagemagick/rotate3D/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply