Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.88k stars 1.5k forks source link

Option to save a custom dpi (density?) in a jpg #465

Closed thepeels closed 9 months ago

thepeels commented 8 years ago

I have a site processing images for including in word and pdf documents to be printed at 300dpi. Is it possible to add a class to save the image with 300dpi in the image properties? This enables the image to be shown at the correct size by default instead of needing to be re-sized by the user.

ziazon commented 8 years ago

I second this, this is also important when converting SVG (vector) images to a non vector format and to do so, you may need to use the dpi to control the "size" of the image without loosing image quality.

An example of how i do this now, lets say a DPI of 6000 with Imagick is:

        $image = new Imagick();
        $image->setResolution(6000, 6000);
        $image->setBackgroundColor(new ImagickPixel('transparent'));
        $image->readImageBlob(file_get_contents('path/to/image.svg');
        $image->setImageFormat("png32");
        $image->writeImage('path/to/new-image.png');

Now obviously I know that after this I can pass the $image object into Intervention, but it would be nice to have the setResolution method built into the Intervention api.

badalsurana commented 6 years ago

+1 for the setResolution method built into the Intervention api

Osi-R-isK commented 6 years ago

I have create the Imagick command for setImageResolution methode, where can I submit my file?

jasperf commented 5 years ago

I have create the Imagick command for setImageResolution methode, where can I submit my file?

You can do a pull request at this repo I would think @gregoryroda . Was looking for something like this for @2 retina images so this would be a welcome addition.

LastDragon-ru commented 5 years ago

959 😄

olivervogel commented 9 months ago

This should be possible with version 3.