[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] export map to image bug
|
I'm working on fixing a bug where exporting a map to image to a
non-alpha image format (ie: jpeg) results in an image with a weird
background colour. I've narrowed down the problem to the creation of
the bufferedImage creation in ExportMapToImageWizard.java:
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
This line works fine for images being exported to formats that support
alpha (like png). If I change the type in the above line to
TYPE_INT_RGB it works for all image formats. I'm assuming it is alright
to fix this bug by simply changing that? Are there any reasons that a
png or other format would need to be saved from a bufferedImage with
alpha support? The resulting image (as far as I can tell) is always
just a composite built up from all the map layers into a single image
anyways.
Initially I was trying to determine a way to use a different
bufferedImage type depending on if the image format it will eventually
be saved to supports alpha, but I couldn't figure out a way to easily
determine that short of making my own long list of all known formats and
if they support alpha. I didn't think this was the best solution since
that list could change or need updating. Is there any system built into
uDig that can already tell what image formats support alpha or not? If
not, is simply changing the above type to RGB instead of ARGB an
acceptable fix for this bug? Thanks,
--
Graham Davis
Refractions Research Inc.
gdavis@xxxxxxxxxxxxxxx