digitalmars.D - PNG image en- and de-coders.. 2020 update
- Andy Balba (22/22) Aug 11 2020 Found this 2012 Forum post :
- aberba (5/14) Aug 12 2020 Recommended to someone and it was well liked. Thanks for doing
- Andy Balba (15/31) Aug 12 2020 gif image format is not supported at all, only png, bmp, tga and
Found this 2012 Forum post : https://forum.dlang.org/post/jrklsj$2lt9$1 digitalmars.com and thought that D-folks interested in this topic may find an "update" helpful. FWIW here's my contribution to such an update (others obviously appreciated): https://code.dlang.org/packages/imageformats has a very quick learing curve and allows easy extraction all code related to encoding and decodeing PNG images into a single module. The PNG code handles 8- and 16-bit color depths, gary colors, gray+alpha, RGB and RGBA. This code also offers en- and de-coding of BMP and TGA, and de-coding only of JPEG; but my interest is PNG only. To this extracted module I've added other modules /functions for : * commonly used color transformation functions e.g. rgb_to_ycbcr(), RGB_to_gray(), wave_length_nm_to_rgb() * various RGB color-maps * a Cartesian system that transforms 2D X-Y Cartesian co-ordinates into xy screen coordinates allowing one to create images using X-Y instead of screen co-ordinates * several utility functions
Aug 11 2020
On Tuesday, 11 August 2020 at 18:29:28 UTC, Andy Balba wrote:Found this 2012 Forum post : https://forum.dlang.org/post/jrklsj$2lt9$1 digitalmars.com and thought that D-folks interested in this topic may find an "update" helpful. [...]Recommended to someone and it was well liked. Thanks for doing this. It seems getting image dimensions for .gif files isn't supported though. Or is it that .gif files aren't supported at all?// format specific functions PNG_Header hdr = read_png_header("peruna.png"); IFImage i3 = read_jpeg("porkkana.jpg"); write_tga("porkkana.tga", i3.w, i3.h, i3.pixels);
Aug 12 2020
On Wednesday, 12 August 2020 at 21:59:20 UTC, aberba wrote:On Tuesday, 11 August 2020 at 18:29:28 UTC, Andy Balba wrote:gif image format is not supported at all, only png, bmp, tga and jpeg. For jpeg only decoding is supported. When generating my own image files, I prefer to stick with png format. Non-png formatted images that I obtain from external sources, fall into two categories: - those I only want to view i just pass on to image viewer software. - those I want to modify in any way, are first converted to png format using on-line image-format converters. Then I work with the png file using various C++ apps I previously developed prior to my transition to Dlang. I'm currently converting my most heavily-used C++ apps to DFound this 2012 Forum post : https://forum.dlang.org/post/jrklsj$2lt9$1 digitalmars.com and thought that D-folks interested in this topic may find an "update" helpful. [...]Recommended to someone and it was well liked. Thanks for doing this. It seems getting image dimensions for .gif files isn't supported though. Or is it that .gif files aren't supported at all?// format specific functions PNG_Header hdr = read_png_header("peruna.png"); IFImage i3 = read_jpeg("porkkana.jpg"); write_tga("porkkana.tga", i3.w, i3.h, i3.pixels);
Aug 12 2020