How to resize an image ? 🤔

vnr cfcr at gmail.com
Sun Dec 27 18:48:18 UTC 2020


On Sunday, 27 December 2020 at 16:49:49 UTC, Guillaume Piolat 
wrote:
> On Friday, 25 December 2020 at 20:59:03 UTC, vnr wrote:
>> Hello 😺
>>
>> For a small "script" that generates printable files, I would 
>> need to change the size of an image (which is loaded into 
>> memory as an array of bytes) to shrink it to scale if it 
>> exceeds the A4 page size.
>>
>> To load the images into memory and generate a PDF, I use the 
>> "printed" package. It is not very provided but is sufficient 
>> for my use, I just need the resize option... Is there a 
>> relatively simple way to do this?
>>
>> Thank you.
>
> Hello,
>
> I've updated `printed` to v1.0.1, you can now the call:
>
>     /// Draws an image at the given position, with the given 
> width and height.
>     /// Both `width` and `height` must be provided.
>     void drawImage(Image image, float x, float y, float width, 
> float height);
>
> http://printed.dpldocs.info/printed.canvas.irenderer.IRenderingContext2D.html


Thank you very much for all your answers!
The one given at the beginning by Adam D. Ruppe was fine with me, 
but the update of printed is very appreciable, so I use 
successfully this last feature which is the easiest to use.


More information about the Digitalmars-d-learn mailing list