Hello,
I am using Imagemagick on my web app. now I have a problem on resizing. when I want to resize an image it changes the image's resolutions.
for example look at this:
This is the original image: http://www.wallpapercharm.com/wallpapers/download/6772 (its v and h resolutions are 140 & 140)
This is the resized image: http://www.wallpapercharm.com/wallpaper ... /1280X1024 (its v and h resolutions are 140 & 356 receptively)
as you can see the horizontal resolution is changed to 356!
the command I use is this : -resize 1280x1024 "full_src_path" "full_dst_path "
Problem on doing resize
Problem on doing resize
Last edited by rezanew on 2009-03-28T14:36:05-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Problem on doing resize
rezanew wrote:Hello,
I am using Imagemagick on my web app. now I have a problem on resizing. when I want to resize an image it changes the image's resolutions.
for example look at this:
This is the original image: http://www.wallpapercharm.com/wallpapers/download/6736 (its v and h resolutions are 140 & 140)
This is the resized image: http://www.wallpapercharm.com/wallpaper ... /1280X1024 (its v and h resolutions are 140 & 356 receptively)
as you can see the horizontal resolution is changed to 356!
the command I use is this : -resize 1280x1024 "full_src_path" "full_dst_path "
IM tries to preserve aspect ratio when using -resize.
When I open your images, I get
Original:
identify -verbose 1920x1440.jpg
Image: 1920x1440.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 1920x1440+0+0
Resolution: 55.1181x55.1181
Print size: 34.8343x26.1257
Units: PixelsPerCentimeter
Resized:
identify -verbose 1280x960.jpg
Image: 1280x960.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 1280x960+0+0
Resolution: 0.572917x55
Print size: 2234.18x17.4545
Units: PixelsPerCentimeter
What version of IM are you using? How are you measuring resolution? The latter resolution and print sizes do look strange to me. Perhaps a shift of decimal 2 places? I am on IM 6.5.0-9 Q16
try
convert "full_src_path" -resize 1280x1024 "full_dst_path"
If you want to get exactly 1280x1024 size then add the exclamation to the end of your size. You may have to escape it.
convert "full_src_path" -resize 1280x1024! "full_dst_path"
Re: Problem on doing resize
Thanks for your reply.
I am using windows Vista image properties to get the resolution (even after changing the size Vista can't show it properly).
I am using this version 6.5.03 Q16.
I used the both command you said but the problem is not solved yet! but now I get something, this command only has problem with these type of images, I mean the only difference between these and other images is resolution unit, can it cause this problem!?
I am using windows Vista image properties to get the resolution (even after changing the size Vista can't show it properly).
I am using this version 6.5.03 Q16.
I used the both command you said but the problem is not solved yet! but now I get something, this command only has problem with these type of images, I mean the only difference between these and other images is resolution unit, can it cause this problem!?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Problem on doing resize
rezanew wrote:Thanks for your reply.
I am using windows Vista image properties to get the resolution (even after changing the size Vista can't show it properly).
I am using this version 6.5.03 Q16.
I used the both command you said but the problem is not solved yet! but now I get something, this command only has problem with these type of images, I mean the only difference between these and other images is resolution unit, can it cause this problem!?
Both images seem to be using the same units. So I don't think that is the issue. My Mac reports: 140 amd 139/7 dpi. Note IM reports dpc (dots per centimeter) for units. But you can change that with -units. see
http://www.imagemagick.org/script/comma ... .php#units
for example
convert 1280x960.jpg -units PixelsPerInch 1280x960b.jpg
identify -verbose 1280x960b.jpg
Image: 1280x960b.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 1280x960+0+0
Resolution: 0.0104167x55
Print size: 122880x17.4545
Units: PixelsPerInch
But still the resolution still does not look right or I am misinterpreting the Resolution value. I thought it would be density in dpi or dpc. Thus 960/55=17.4545, but 0.0104167 seems like some error and should be close to 55
Hopefully Anthony or Magick can shed more light on this.
Re: Problem on doing resize
Thanks a lot, I solved the problem by adding this:
-units Undefined
-units Undefined