ASP CLASSIC: center crop image
Posted: 2017-02-02T04:14:00-07:00
Hi, I'm using ImageMagck to generate thumbnails from a big image on my classic asp site.
This is my resize command that works correctly:
imageMagick.Convert "1-thumb.jpg", "-resize=" & newWidth & "x" & newHeight, "1-thumb.jpg"
My goal is to create thumbnails with the same size so I control, with an IF procedure, if my image is larger than 253 px and then I crop it:
imageMagick.Convert "1-thumb.jpg", "-gravity Center", "-crop" , newWidth & "x" & newHeight & "+0+0", "+repage", "1-thumb.jpg"
If I put the command like the tutorial tell me the server return to me this error:
ImageMagickObject.MagickImage.1 error '80041771'
convert: 410: unrecognized option `-gravity Center' @ error/convert.c/ConvertImageCommand/1783:
If I modify the command like this:
imageMagick.Convert "1-thumb.jpg", "-gravity", " Center", "-crop" , newWidth & "x" & newHeight & "+0+0", "+repage", "1-thumb.jpg"
it works but the image will be cropped from the left side and not from the center.
Can you help me?
This is my resize command that works correctly:
imageMagick.Convert "1-thumb.jpg", "-resize=" & newWidth & "x" & newHeight, "1-thumb.jpg"
My goal is to create thumbnails with the same size so I control, with an IF procedure, if my image is larger than 253 px and then I crop it:
imageMagick.Convert "1-thumb.jpg", "-gravity Center", "-crop" , newWidth & "x" & newHeight & "+0+0", "+repage", "1-thumb.jpg"
If I put the command like the tutorial tell me the server return to me this error:
ImageMagickObject.MagickImage.1 error '80041771'
convert: 410: unrecognized option `-gravity Center' @ error/convert.c/ConvertImageCommand/1783:
If I modify the command like this:
imageMagick.Convert "1-thumb.jpg", "-gravity", " Center", "-crop" , newWidth & "x" & newHeight & "+0+0", "+repage", "1-thumb.jpg"
it works but the image will be cropped from the left side and not from the center.
Can you help me?