Image Density
-
- Posts: 5
- Joined: 2014-08-27T07:39:21-07:00
- Authentication code: 6789
- Location: Ontario, Canada
Image Density
I am trying to reduce image density (image is uploaded from camera at 300dpi).
I want to conform all images to 72 dpi while processing.
This is the code I have, but the resulting image remains 300dpi when tested in Photoshop.
Any help would be greatly appreciated.
use Image::Magick;
$status = $image->Read($img);
$status = $image->Resample('72x72');
$status = $image->Set(colorspace=>'RGB');
$status = $image->Set(quality=>'100');
$status = $image->Write($img);
I want to conform all images to 72 dpi while processing.
This is the code I have, but the resulting image remains 300dpi when tested in Photoshop.
Any help would be greatly appreciated.
use Image::Magick;
$status = $image->Read($img);
$status = $image->Resample('72x72');
$status = $image->Set(colorspace=>'RGB');
$status = $image->Set(quality=>'100');
$status = $image->Write($img);
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Image Density
Has the input already been Photoshopped? If so, it may have written its own internal metadata, which IM doesn't update, but "-strip" might remove.
snibgo's IM pages: im.snibgo.com
-
- Posts: 5
- Joined: 2014-08-27T07:39:21-07:00
- Authentication code: 6789
- Location: Ontario, Canada
Re: Image Density
No the image is direct from the camera. I also tried Set(density=>"72x72"); method to no avail.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Density
Can you post your images to some free hosting service such as dropbox.com and put the URLs here? Or post the information from identify -verbose for your images.
What version of Imagemagick, libjpeg and platform are you using?
What version of Imagemagick, libjpeg and platform are you using?
-
- Posts: 5
- Joined: 2014-08-27T07:39:21-07:00
- Authentication code: 6789
- Location: Ontario, Canada
Re: Image Density
ImageMagick 6.2.8 05/08/12 Q16
This is one of the images I was testing with http://dev.riverquestchallenge.com/uploads/P1010117.JPG
See here for identify -verbose http://dev.riverquestchallenge.com/cgi- ... ze_test.pl
I am not sure how to confirm libjpeg or platform - do you mean which *nix??
Thanks for any and all input.
This is one of the images I was testing with http://dev.riverquestchallenge.com/uploads/P1010117.JPG
See here for identify -verbose http://dev.riverquestchallenge.com/cgi- ... ze_test.pl
I am not sure how to confirm libjpeg or platform - do you mean which *nix??
Thanks for any and all input.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Density
That version of IM is over 600 versions old. It is ancient. It could be there was a bug in that version and the only recourse would be to upgrade. But I do not know Perlmagick and cannot say if your code is correct or not. So some Perlmagick user would have to confirm. Can you provide the simplest code you have for just that task with filenames and actual argument included. That would make it easier for someone else to confirm your code.
Yes, I meant what flavor or Unix. I know for some it is easier to upgrade than for others.
Have you tried the equivalent of your Perlmagick in the command line to see if that works OK or not?
Yes, I meant what flavor or Unix. I know for some it is easier to upgrade than for others.
Have you tried the equivalent of your Perlmagick in the command line to see if that works OK or not?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Image Density
In IM 6.8.9.7 Q16 Mac OSX, this command works fine.
The IM verbose information shows:
Since your input image is already RGB, you do not need to set colorspace RGB. But if you do, it should be right after reading the input image.
If you are trying to be sure that any CMYK image is convert to RGB, then you should use the equivalent of -colorspace RGB and not -set colorspace RGB. I do not know what the equivalents are for PerlMagick.
Code: Select all
convert P1010117.JPG -resample 72x72 -quality 100 test.jpg
Code: Select all
Image: test.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 704x528+0+0
Resolution: 72x72
Print size: 9.77778x7.33333
Units: PixelsPerInch
Type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
If you are trying to be sure that any CMYK image is convert to RGB, then you should use the equivalent of -colorspace RGB and not -set colorspace RGB. I do not know what the equivalents are for PerlMagick.
-
- Posts: 5
- Joined: 2014-08-27T07:39:21-07:00
- Authentication code: 6789
- Location: Ontario, Canada
Re: Image Density
Yes, maybe related to version, looking into it as running the following command creates new image but resolution does not change:
convert P1010117.JPG -resample 72x72 -quality 100 test_P1010117.JPG
convert P1010117.JPG -resample 72x72 -quality 100 test_P1010117.JPG