[Gambas-user] Problems with Image.Save and Image.RotateRight Methods

Claus Dietrich claus.dietrich at freenet.de
Sat Sep 25 17:28:03 CEST 2021


When I pick up a bitmap from my scanner (300dpi, A4 size), save it
as file, rotate it and also save the rotated image like this:

hImg = Last.Peek()
hImg.save("/home/claus/normal.png")
hImg.RotateRight
hImg.RotateRight
hImg.save("/home/claus/rotated.png"

strange things are happening (tested with Gimp):

A) Image format if saving as PNG:
              normal.png              rotated.png          
Pixel Size:   2480 x 3508 pixels      2480 x 3508 pixels
Print Size:   209.97 x 297,01 mm      656.1 x 928,0 mm
Resolution:   11.811 dpmm             3.78 dpmm

B) Image format if saving as JPEG:
              normal.jpg              rotated.jpg          
Pixel Size:   2480 x 3508 pixels      2480 x 3508 pixels
Print Size:   874.9 x 1237.5 mm       656.1 x 928.2 mm
Resolution:   72 dpi                  96 dpi

The print sizes and resolutions are only correct if I store the original
scanned imageas PNG. If I saveit as JPEG or rotate it, the print sizes
are changed and resolutions as well,which is messingup the generation
of searchable PDFs with tesseract(OCR) in my scanner app.

Are there bugs in the Image.Save and Image.RotateRight methods? Or
can somebody explain this? Are the sizes irrelevant and tesseract has
a problem?

Claus





More information about the User mailing list