Image size
Posted
#1
(In Topic #1576)
Guru

Posted
Guru

Or use picture.save compression/quality settings.
Read wiki on how the quality option works as it different for different file types.
I found a long time ago that saving a screenshot for the mailing list as png will not send as there's a file size limit. Save as jpeg though and all is okay <EMOJI seq="1f60a" tseq="1f60a">😊</EMOJI>
Posted
Guru

Picture.Load(sPath).Save(sPath, 0)
Re quality settings: for jpeg it affects quality for png it affects compression.
Posted
Expert

I didn't know about this, and happy to learn something "new"
/comp/gb.qt4/image/save - Gambas Documentation
Posted
Guru

Interestingly, just saving a 6.2MB .png as a .jpg reduced the file size to 1.5MB.
The Quality part of Sub Save ( Path As String [ , Quality As Integer ] ) seems to be logarithmic. The image below shows the value (Quality) used, the new file size in kb and the percentage of the original picture.
<IMG src="https://www.cogier.com/gambas/PictCompression.png">
</IMG>
Posted
Guru

<IMG src="https://www.cogier.com/gambas/PictCompression2.png">
</IMG>
Posted
Guru

so higher must be adding data.
I remember having this issue once when i was loading and saving an image.
png may be slower but png is "lossless" so possibly the best way to get the smallest file with no loss of quality.
1 guest and 0 members have just viewed this.


