Tuesday, April 24, 2018

TransparentJPG2

   So a while back I had the need for a lossy image format that supports transparency and is widely used. I decided to try my hand at making my own solution. I settled to base the format on Jpeg since it is arguably the most widely used image format. The only problem is that it doesn't support transparency. I set out to essentially inject transparency data into the Jpeg format with pretty acceptable results. After using it for a while though I noticed some problems. There were artifacts sometimes present at the top edge of images. After some investigating this is caused by the image height not being a factor of 8 since Jpeg works on 8x8 chunks the transparency information would get mixed in with the color information causing it to have a slim but noticeable artifact. Version 2 fixes the problems as well as provides some performance improvements. The tool set provided though is different from the first version as their is more than just a converter, a viewer, and the library. This version also utilizes a valid Jpeg header and Magic making it view-able in some applications that natively support Jpeg  (like Google Chrome, Ms Paint, etc) just that the image will not appear as intended.

======================================================================

Original TransparentJPG: POST

======================================================================

Download: MEGA

======================================================================

Inside the rar container are several executables and a DLL.

PrependTransparentJpgHeader.exe - Adds the proper Magic/Header information to normal Jpg file.    This is used after converting the Master to Jpeg.

TJPG.ico - The icon used for the format.

ToTransparentJpg.exe - A ease of use tool to convert from PNG straight to Tjpg without all the hassle of using the other files.

ToTransparentJpgMaster.exe - Used to output the image used to construct the Tjpg. The output image is in BMP format and can be converted via any tool/method you choose.

TransparentJPG.dll - The library to integrate TransparentJpg2 into your .Net programs.

TransparentJpgToPng.exe - Converts from Tjpg format to Png format.

TransparentJpgViewer.exe - Tool used to view Tjpg files.

======================================================================

Usage: You are free to use the ToTransparentJpg.exe if you want something quick and simple. But if you want more control you would either use the TransparentJPG.dll if you are a .Net programmer or use the provided tools in the following order.

1) Drag and Drop your Png image over ToTransparentJpgMaster.exe - It will produce a Bmp file that calculates and places the color and alpha in the proper place for when the Master is converted to Jpg. You are free to modify the Master in its Bmp state as you like.

2) Convert the Master Bmp to Jpeg anyway you choose - the reason this step is included is so people can use their own method of conversion with filters and smoothing and quality settings, as well as their choice of Jpeg encoder.

3) Turn the Master Jpg to Tjpg by Drag and Drop over PrependTranparentJpgHeader.exe - This will prepend the proper Magic/Header and save a new Tjpg file.

Here you can see some comparisons:
PNG vs TJPG2



TJPG vs TJPG2

No comments: