Setting image resolution with Rmagick

Hi

Has anyone had success with setting image resolution with Rmagick.

I am resizing an uploaded image with Rmagick, problem is it keeps the
original images resolution and I want to change it to 72dpi.

<<<<<< code example >>>>>>>>>>

these are the various techniques I have tried when and after reading

the file, trying any or all of them does not work.
image_render = Magick::Image.read(temp_path){self.density=72}[0]

image_render.units=Magick::PixelsPerInchResolution
image_render.x_resolution=72
image_render.y_resolution=72

I also tried this when writing the image to disk

image_render.write(temp_path){self.quality = 90,
self.units=Magick::PixelsPerInchResolution, self.density = 72}

<<<<<< code example : end>>>>>>>>>>

Any thoughts/ideas would be much appreciated

Best regards
Ant


Ant Peacocke

www.levelsystems.net
T: + 33 (0) 8 70 46 63 37
M: + 33 (0) 6 09 81 06 00

Has anyone figured out this image resolution problem?
“convert -density xx in.eps out.png” works as expected but I can’t
figure out how to do this with RMagick.
Is this an RMagick bug?

Thanks,
Quinn

Ant Peacocke wrote:

Hi

Has anyone had success with setting image resolution with Rmagick.

I am resizing an uploaded image with Rmagick, problem is it keeps the
original images resolution and I want to change it to 72dpi.

<<<<<< code example >>>>>>>>>>

these are the various techniques I have tried when and after reading

the file, trying any or all of them does not work.
image_render = Magick::Image.read(temp_path){self.density=72}[0]

image_render.units=Magick::PixelsPerInchResolution
image_render.x_resolution=72
image_render.y_resolution=72

I also tried this when writing the image to disk

image_render.write(temp_path){self.quality = 90,
self.units=Magick::PixelsPerInchResolution, self.density = 72}

<<<<<< code example : end>>>>>>>>>>

Any thoughts/ideas would be much appreciated

Best regards
Ant


Ant Peacocke

www.levelsystems.net
T: + 33 (0) 8 70 46 63 37
M: + 33 (0) 6 09 81 06 00