17 April 2015, 07:48 | #1 |
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
new PNG to ILBM converter for Amiga, MorphOS, Linux, FreeBSD, Haiku and Solaris
I've just released my PNG to ILBM converter.
There's some basic usage examples. All of the converted images are converted from this image: http://oscomp.hu/depot/ferrari.png With the exception of Amiga, which converted a pre-shrinked version of this image. (Due the limited memory in my A500+, it wasn't able to deal with a HD image.) The converter supports resampling, quantizing and dithering to any bitplanes, used by the Amiga, including EHB. For example: Code:
png2ilbm ferrari.png ferrari_ehb.iff -w=320 -d -bp=ehb (http://oscomp.hu/depot/ferrari_ehb.iff) The converter also supports hi-res/laced pictures: Code:
png2ilbm ferrari.png ferrari_8hril.iff -w=640 -bp=8 -hr -il -d (http://oscomp.hu/depot/ferrari_8hril.iff) If there is a need to convert a picture which can only use certain registers, then the others can be preserved: Code:
png2ilbm ferrari1.png ferrari_5pr.iff -d -bp=5 -pr=0-7,17-19 (If the target bitplane number is EHB, then the preserved registers will extended to the upper 32 imaginary registers too, since if e.g. register 11 is unusable, then register 43 will be unusable too.) (http://oscomp.hu/depot/ferrari_5pr.iff) It's possible to override colour register during quantization. These registers will be also preserved during the quantization, but then they will be used during the colour replacing. It can be used for partial colour adds (for example if the picture can use the registers used for other purposes, but cannot overwrite them), but also can be used to quantize to a fixed palette. Code:
png2ilbm ferrari.png ferrari_c64.iff -w=320 -d -bp=8 -srl=c64-136.pal (http://oscomp.hu/depot/ferrari_c64.iff) To use override from CLI, use the "sr" switch, the "srl" is to load the override list from a file. The format for them is identical: register:colour,register:colour,register:colour... All of the generated pictures uses 24-bit palettes, but the converter can forced to convert them to 12-bit ones. The non-AGA Amigas are able to show the 24-bit palettes, but they only use the top 4-bit, which are not colour-correct shrinking, since for example $e1 will be $e, but in reality it should be $d ($e1 is much closer to $dd than $ee). So, with the "f4b" switch the converter will colour-correctly shrink all the colours, then extend them again (also colour-correctly). By this the non-AGA machines will show the colours without brightness shifting. However, since the quantizer works on 24 bit and the shrinking happens after the palette quantization, it can produce collosions, which can be more worse, than a non-correctly bright picture. (E.g. both the colours "3f89b1" and "4590a9" will be "4488aa" and the final image will use less colours.) So, use with care. Binaries can be downloaded the for all supported platform from there: http://bgafc.t-hosting.hu/png2ilbm.html (The uncompressed binaries are weigh 'round 60-70 kB on every platform.) Currently supported platforms are Amiga, Linux, Haiku, FreeBSD, MorphOS and Solaris on x86 and PPC architectures (Amiga is 68k of course). Further platforms (OSX, OS4) and archs (PPC64, Sparcs) will be supported, whenever i'll get there. On AROS the build is failed, the log is also on the download page, if someone can tell me what is the problem, don't hesitate. The quantizer eats up a lot of memory (around 7-800k), so on the Amiga, at least 2 MB RAM is recommended. With 2 MB of Chip RAM, there should be no problem about converting 320x200@24 pictures. (My A500+ managed to convert them during the tests, with only 2 MB of Chip RAM.) If there are plenty of RAM (cca. 16 MB), then even HD pictures can be converted on the Amiga. (Well...slow water washes the coast, a HD picture can take much hours for a pure 68000.) The binaries are standalone, they don't need external libraries on any platform, with the exception of the pure 68000 and 68020 Amiga versions which are needs mathieee*.libraries for floating point calculations. The 68020+68881 version don't needs FP libraries, but naturally it needs an FPU. Well, have fun and don't forget to report bugs. :P The binaries contains the detailed manual about everything, but if there are questions, then ask them. |
17 April 2015, 13:20 | #2 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,744
|
Quote:
|
|
17 April 2015, 16:10 | #3 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Thanks, the ability to preserve color registers is particularly useful. Any chance for Mac OS X and Windows binaries? I could help you build them if you're not too protective of the sources.
|
17 April 2015, 16:41 | #4 | ||
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
Quote:
Quote:
The source is closed, sorry. Edit: If you have tips, how to breathe life into an intel OS X under Virtual Box or VMware, then maybe i don't need a real intel Mac. Last edited by TCH; 17 April 2015 at 16:43. Reason: Added intel OSX emulation part |
||
18 April 2015, 07:56 | #5 |
Registered User
Join Date: Mar 2009
Location: New York
Posts: 552
|
Why keep the source closed?
|
18 April 2015, 11:36 | #6 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,744
|
Accordingly to you some colors can be lost as first CLUT is calculated and later you doing 24 bit to 12 bit (upper nibble is copied to lower part exactly as in Amiga).
My point was that first 24 bit need to reduced to 12 bit with same approach as in AGA/ECS then next steps (or one step quantization but with 12 bit values as output). Side to this any chance to describe EHB approach (how CLUT is created)? |
18 April 2015, 12:30 | #7 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
ooh nice
|
18 April 2015, 20:05 | #8 | ||
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
Why not?
Quote:
Quote:
Last edited by TCH; 18 April 2015 at 20:06. Reason: missing 'do' keyword |
||
18 April 2015, 20:10 | #9 | |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Well i suppose many of us could benefit from it. Personally i'd like to be able to incorprate a PNG loader into some of my own code, albeit nothing so sophisticated as yours.
Quote:
|
|
18 April 2015, 22:04 | #10 | ||
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
Quote:
Quote:
I had to rewrite the whole code, to be able to use the algorithm as a function and also i thrown out the color replacing, because the euclidean color searching was more efficient, and i have added the ability to quantize to EHB or 12-bit and also to get the resulting image as a stream of lookup indexes; but the palette quantizer's algorithm - which is responsible for finding the best colours - is remained the same. Last edited by TCH; 18 April 2015 at 22:07. Reason: comma => semicolon |
||
19 April 2015, 12:47 | #11 |
Registered User
Join Date: Mar 2009
Location: New York
Posts: 552
|
Well, there are a lot of reasons. If you have no plan to try and make money from the library, why not put the sources out there too, so others can carry on your work when you get bored with it? Releasing source (and properly licensing) early also means you can possibly engage other contributors.
It's your prerogative, but I don't see any advantage of a project like this being closed source. |
19 April 2015, 16:20 | #12 |
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
|
19 April 2015, 21:42 | #13 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
Maybe i missed that one:
Is the alpha channel preserved? If yes, how? (p.s.: i donot read it all because it is not in coders section!) |
19 April 2015, 22:03 | #14 | ||
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,744
|
Quote:
Going for 12 bit allow avoid losing some CLUT entries. Quote:
Side to this i hope You are aware of this new class of algorithms: http://members.ozemail.com.au/~dekker/NEUQUANT.HTML http://www.cs.berkeley.edu/~dcoetzee/downloads/scolorq/ Probably they are to slow for native Amiga but for modern CPU they provide splendid results. And Thank You Very Much! |
||
19 April 2015, 23:57 | #15 | |||
Newbie Amiga programmer
Join Date: Jun 2012
Location: Front of my A500+
Age: 38
Posts: 372
|
If by preserving you mean it is stored into the ILBM as it was, then the answer is of course no, since the ILBM does not support alpha. However, the alpha channel is not ignored; the program renders a 24-bit image from every type of PNG, including alpha channeled ones - the alpha channel defines the mixing ratio of the foreground and background colours. Try it with an alpha channeled PNG. If the PNG does not have a background colour, then the program defines it as black, but you can overwrite the background color, with the "fb" switch.
Quote:
Quote:
Quote:
|
|||
20 April 2015, 00:11 | #16 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
my latest thinking is, one would want greater accuracy for the bright colours than the dark ones. So maybe one could start by only analysing the colours that have at least one component of 128 or greater. Then maybe you could pull off the least-useful bright colours one at a time and replace them with darker colours.
|
20 April 2015, 00:34 | #17 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
|
20 April 2015, 00:48 | #18 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
Quote:
What was the question again? |
|
20 April 2015, 00:51 | #19 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
presumably "alpha" can just be regarded as another component in the palette entries, i assume ILBM packs the 12 bit palette entries into 16 bit words so one could use the upper 4 bits for alpha anyway
|
20 April 2015, 01:29 | #20 |
Registered User
Join Date: Mar 2009
Location: New York
Posts: 552
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
new WAV to 8SVX converter for Amiga, MorphOS and Linux | TCH | Amiga scene | 26 | 11 December 2023 16:10 |
FS-UAE 2.0 for Windows, Mac OS X, Linux and FreeBSD | FrodeSolheim | News | 6 | 31 October 2012 23:25 |
PNG Icon to Color Icon Converter? | Leandro Jardim | request.Apps | 1 | 24 May 2010 04:39 |
UAE for Sun Solaris (Sparc) | commie1974 | support.OtherUAE | 8 | 31 August 2006 21:46 |
convert .info to png or jpg(with linux) | lostfriend | request.Apps | 4 | 22 March 2006 01:26 |
|
|