Just for some insight:
I was trying to optimise file size by using a 4 bit palette and this was a 
suitable and simple way of doing so.
Another tip I found was to avoid the use of anti-aliasing, because it ends up 
generating intermediate colours, which makes PNG compression more difficult 
even though the palette bit-depth hasn't changed.
When testing with native JAI and I/O, I found that when using a non-standard 
case, Sun/Oracle don't seem to bother optimising. Judging by the file sizes, 
they fall back to non-native.

Simon



.

From: [email protected] [mailto:[email protected]] On Behalf Of Andrea 
Aime
Sent: 29 November 2013 11:16
To: Simon Hartley
Cc: Geoserver-devel
Subject: Re: [Geoserver-devel] New PNG encoder: how about a GSIP to merge it 
into core on trunk?

On Fri, Nov 29, 2013 at 12:06 PM, Simon Hartley 
<[email protected]<mailto:[email protected]>> wrote:
When playing with the code I created a 4 bit grayscale image.
The reason I use ushort is because it results in better quality images than if 
I use byte (I had issues with lines not drawing smoothly).

BufferedImage bi =  ImageTypeSpecifier
                                                .createGrayscale(4, 
DataBuffer.TYPE_USHORT, false)
                                                .createBufferedImage(width, 
height);

The ScanlineProviderFactory didn't like this because of the use of USHORT in 
combination with an IndexColorModel.
One thing I needed to do to get it to work is create a constructor on 
RasterShortSingleBandProvider which takes a bit depth (4 in this case).

Weird setup indeed. Yes, what you propose should work.
More in general, this PNG encoder should probably have a fallback mode, if we 
cannot create a scanline provider,
it should fall back on the JDK one I guess, to make sure it does not break when 
plugging custom raster sources
like yours.


Looking at the code, can the final <else if> ever work?
The previous <else if> checks if the ColorModel is an instance of 
IndexColorModel and then the next <else if>,
knowing that it isn't an IndexColorModel, casts the ColorModel to 
IndexColorModel.

No, you're right, it does not. Weird, I guess none of the official PNG color 
models ever get there

Cheers
Andrea

--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more 
information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
*** This communication has been sent from World Fuel Services 
Corporation or its subsidiaries or its affiliates for the intended recipient 
only and may contain proprietary, confidential or privileged information. 
If you are not the intended recipient, any review, disclosure, copying, 
use, or distribution of the information included in this communication 
and any attachments is strictly prohibited. If you have received this 
communication in error, please notify us immediately by replying to this 
communication and delete the communication, including any 
attachments, from your computer. Electronic communications sent to or 
from World Fuel Services Corporation or its subsidiaries or its affiliates 
may be monitored for quality assurance and compliance purposes.***

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to