[Gambas-user] Picture.ToString() ?
Bruce Steers
bsteers4 at gmail.com
Thu Jan 4 05:02:57 CET 2024
On Thu, 4 Jan 2024 at 00:55, Bruce Steers <bsteers4 at gmail.com> wrote:
>
>
> On Wed, 3 Jan 2024 at 23:17, Bruce Steers <bsteers4 at gmail.com> wrote:
>
>>
>>
>> On Wed, 3 Jan 2024 at 23:09, Claus Dietrich <claus.dietrich at freenet.de>
>> wrote:
>>
>>> Hi Bruce
>>>
>>> Am 03.01.24 um 23:44 schrieb Bruce Steers:
>>> > I do not know if any other formats support quality (i thought only
>>> jpeg)
>>>
>>> png also supports "quality". As png is lossless the argument is mapped
>>> to compression and leads to different filesizes (100 = maximum filesize
>>> and 0 = minimum filesize).
>>>
>>> Best regards
>>>
>>> Claus
>>>
>>
>> I get the following message if i pass any quality value...
>>
>> Dim sPic As String = Picture["icon:/16/gambas"].ToString("png", 100)
>>
>> GdkPixbuf-WARNING **: 23:11:20.946: Unrecognized parameter “quality”
>> passed to the PNG saver
>>
>>
>> although sPic does get filled with the image string
>>
>> (sorry it's a warning so not technically an error)
>>
>
> It seems GdkPixBuf does only support the quality flag with saving JPEG.
> https://docs.gtk.org/gdk-pixbuf/method.Pixbuf.save.html
> (i just put that link in the wiki to fix the current broken link @
> https://gambaswiki.org/wiki/comp/gb.qt4/image/save)
>
> I did a test and like you say jpeg saving saves as different file sizes
> and quality but png does not, it prints the warning message and the file
> size of quality 10 and 100 are both the same.
>
> Quote from the page:
>
> Currently only few parameters exist.
>
> JPEG images can be saved with a “quality” parameter; its value should be
> in the range [0, 100]. JPEG and PNG density can be set by setting the
> “x-dpi” and “y-dpi” parameters to the appropriate values in dots per inch.
>
> etc, etc
>
I did a better test on ALL the "supported formats" as stated on the
https://gambaswiki.org/wiki/comp/gb.qt4/image/save page
I Tried Picture.Save and Picture.Image.Save with all formats to save to
files with a quality setting of 10 and 100
Results
gtk3
.jpg ,files are different sizes and quality
.png , files the same , pixbuf warning message
.bmp , files are the same, no message
.gif , unknown format
.xpm , unknown format
qt5
.jpg ,files are different sizes and quality
.png , files are different sizes and quality
.bmp , files are the same, no message
.gif , unknown format
.xpm , files are the same.
with qt using quality value of 10 for xpm and png gave the following
message..
qt.gui.icc: fromIccProfile: failed minimal tag size sanityqt.gui.icc:
fromIccProfile: failed minimal tag size sanity
So apologies, i see it's not so much a gambas bug but more a somewhat
toolkit dependent method with varying results.
My conclusion/advice on using quality, only use the quality option if
needed and only jpeg is reliable.
Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240104/97500ec7/attachment-0001.htm>
More information about the User
mailing list