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?
ASP CLASSIC: center crop image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ASP CLASSIC: center crop image
What version of IM are you using?
snibgo's IM pages: im.snibgo.com
Re: ASP CLASSIC: center crop image
The version of IM is 7.0.4-6-Q16.
Is it possible that this function doesn't work because it is deprecated on website that use ASP?
Is it possible that this function doesn't work because it is deprecated on website that use ASP?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ASP CLASSIC: center crop image
I know nothing about ASP. With recent version of IM, as you have, I don't know why cropping from the center doesn't work.
Of course, you are overwriting the file, so when it has cropped once, re-running the code won't crop again.
Of course, you are overwriting the file, so when it has cropped once, re-running the code won't crop again.
snibgo's IM pages: im.snibgo.com
Re: ASP CLASSIC: center crop image
I have 3 passages for an image:
1) I pick the original, large size, image and I rename it,
2) I resize the renamed image only on height (width proportional),
3) If the width is over 253 px I crop the resized image.
All the process works correctly, incluse crop but it start from the default side, left top, and not on center.
1) I pick the original, large size, image and I rename it,
2) I resize the renamed image only on height (width proportional),
3) If the width is over 253 px I crop the resized image.
All the process works correctly, incluse crop but it start from the default side, left top, and not on center.
Re: ASP CLASSIC: center crop image
Please, can you tell me if my command lines are ok?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ASP CLASSIC: center crop image
I don't use ASP, so can't advise on that.
The IM parts look okay, but what are the values of newWidth and newHeight? And what size is the input image?
The IM parts look okay, but what are the values of newWidth and newHeight? And what size is the input image?
snibgo's IM pages: im.snibgo.com
Re: ASP CLASSIC: center crop image
newWidth = 253 px
newHeight = 357 px
The input image is over 1.000x1.000 px
newHeight = 357 px
The input image is over 1.000x1.000 px
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ASP CLASSIC: center crop image
I suggest you try it as a command, at your shell:
Code: Select all
convert 1-thumb.jpg -gravity Center -crop 253x357+0+0 +repage out.jpg
snibgo's IM pages: im.snibgo.com