Why there is no image compression for GIF, JPEG, PNG image

Discussions about document viewing.
Post Reply
junwei1994
Posts: 10
Joined: Wed May 15, 2019 10:04 am

Why there is no image compression for GIF, JPEG, PNG image

Post by junwei1994 » Thu May 23, 2019 4:03 am

Hi There,

As per subject, there is only image compression for TIFF image type, code as below:

Dim tiffCompression As GdPicture14.TiffCompression = _gdPictureImaging.GetTiffCompression(_currentImage)

and this will return all the available tiffCompression as below:

TiffCompressionUnknown = 0
TiffCompressionNONE = 1
TiffCompressionRLE = 2
TiffCompressionCCITT3 = 3
TiffCompressionCCITT4 = 4
TiffCompressionLZW = 5
TiffCompressionOJPEG = 6
TiffCompressionJPEG = 7
TiffCompressionADOBEDEFLATE = 8
TiffCompressionNEXT = 32766
TiffCompressionCCITTRLEW = 32771
TiffCompressionPACKBITS = 32773
TiffCompressionTHUNDERSCAN = 32809
TiffCompressionDEFLATE = 32946
TiffCompressionAUTO = 65536

But there is no other compression for image type like GIF, JPEG, PNG.

Please help on this. Thanks.

Best Regards,
Jun Wei

junwei1994
Posts: 10
Joined: Wed May 15, 2019 10:04 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by junwei1994 » Fri May 24, 2019 9:39 am

Help on this please ?

Best Regards,
Jun Wei

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by Gabriela » Fri May 24, 2019 1:04 pm

Hello,

Please find the requested methods here:
for JPG (see Quality, Progressive parametets)
SaveAsJPEG
for PNG (see CompressionLevel parameter)
SaveAsPNG
Please refer to the parameters and set them according what you need.

junwei1994
Posts: 10
Joined: Wed May 15, 2019 10:04 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by junwei1994 » Tue May 28, 2019 11:27 am

Hi Gabriela,

This is not what I want.

I would like to have something like the code below:

Dim gifCompression As GdPicture14.GifDisposalMethod= _gdPictureImaging.GetGifCompression(_currentImage)

And it will return something like:

Public Enum GifDisposalMethod
GifDisposalMethodNotSet = -1
NoDisposalMethod = 0
DoNotDispose = 1
RestoreBackgroundColor = 2
RestoreToPrevious = 3
End Enum

Dim jpgCompression As GdPicture14.JpgDctMethod= _gdPictureImaging.GetJPGCompression(_currentImage)

And it will return me something like :

Public Enum JpgDctMethod
Dct_Not_Set = 0
Dct_ISlow = 1
Dct_IFast = 2
Dct_Float = 3
End Enum

Best Regards,
Jun Wei

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by Gabriela » Thu May 30, 2019 2:33 pm

Hi,

The JPG, PNG, GIF formats are others than TIFF. The toolkit opens jpg/png/gif formatted files into a bitmap. Once they are opened, there is no information about the used compression available. And actually, it is not needed, as you should next save the images always defining the required compression. May I ask to explain in details your use-case why you need to know the used compression so maybe we can help you further? Thank you.

junwei1994
Posts: 10
Joined: Wed May 15, 2019 10:04 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by junwei1994 » Fri May 31, 2019 10:14 am

Hi Gabriela,

This is the behavior of our application.

We will show the compression method when users click on picture.

Is it really no way to show this ?

Best Regards,
Jun Wei

junwei1994
Posts: 10
Joined: Wed May 15, 2019 10:04 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by junwei1994 » Mon Jun 03, 2019 10:48 am

Hi Gabriela,

Any update about this issue ?

Best Regards,
Jun Wei

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by Gabriela » Mon Jun 03, 2019 2:54 pm

Hello,

Here are some useful links:
https://superuser.com/questions/919580/ ... t-is-lossy
https://photo.stackexchange.com/questio ... cular-jpeg

Maybe there is a confusion between compression schemes and options used by the compression schemes:
JPEG uses always dctdecode, PNG always uses deflate, GIF LZW.
Almost each compression schemes are using different options. Some of them can be retrieved by exif metadata.

MikeBishop
Posts: 2
Joined: Fri Jun 16, 2023 3:03 pm

Re: Why there is no image compression for GIF, JPEG, PNG image

Post by MikeBishop » Wed Feb 28, 2024 12:52 pm

When it comes to GIF compression, reducing the number of colors and frames, as well as employing techniques like LZW compression, can significantly decrease file sizes.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest