How to resize an image ? 🤔

Guillaume Piolat first.name at guess.com
Sun Dec 27 16:49:49 UTC 2020


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


More information about the Digitalmars-d-learn mailing list