

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.java.dev.jai.interestRe: [JAI] Converting bitmap - DPI and...| From | Sent On | Attachments |
|---|---|---|
| jai-...@javadesktop.org | Nov 17, 2005 9:42 am | |
| Brian Burkhalter | Nov 17, 2005 12:12 pm | |
| jai-...@javadesktop.org | Nov 17, 2005 1:39 pm | |
| jai-...@javadesktop.org | Nov 29, 2005 8:01 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [JAI] Converting bitmap - DPI and bit depth not carrying over | Actions... |
|---|---|---|
| From: | Brian Burkhalter (Bria...@Sun.COM) | |
| Date: | Nov 17, 2005 12:12:17 pm | |
| List: | net.java.dev.jai.interest | |
Looks like it should work.
Can you post a self-contained complete test case and data (if not too big).
Brian
On Thu, 17 Nov 2005, jai-...@javadesktop.org wrote:
Hi;
I am converting a file from one format to PNG and the DPI and bits/pixel are not
carrying over. The DPI is always -1 and the PNG is always 24 DPI.
Partial code here:
ImageInputStream imageInput = ImageIO.createImageInputStream(new
ByteArrayInputStream(image));
Iterator it = ImageIO.getImageReaders("bmp");
ImageReader reader = null;
while(it.hasNext()) {
Object obj = it.next();
if (! (obj instanceof ImageReader))
continue;
reader = (ImageReader) obj;
if (reader.getOriginatingProvider().isStandardImageMetadataFormatSupported())
break;
}
reader.setInput(imageInput);
IIOMetadata meta = reader.getImageMetadata(0);
it = ImageIO.getImageWritersByFormatName(HtmlImage.typeToStr(formats[0])); ImageWriter writer = null; while(it.hasNext()) { writer = (ImageWriter)it.next(); if (writer.getOriginatingProvider().isStandardImageMetadataFormatSupported()) break; } ImageWriteParam writeParam = writer.getDefaultWriteParam(); if (writeParam.canWriteCompressed()) { writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionQuality(0.95f); }
RenderedImage ri = reader.read(0); ByteArrayOutputStream out = new ByteArrayOutputStream(); MemoryCacheImageOutputStream mcios = new MemoryCacheImageOutputStream(out); writer.setOutput(mcios); writer.write(null, new IIOImage(ri, null, meta), writeParam);
reader.dispose(); imageInput.close(); writer.dispose(); mcios.close();
--- [Message sent by forum member 'dav...@windward.net' (David Thielen)]
http://www.javadesktop.org/forums/thread.jspa?messageID=125658𞫚
---------------- Brian Burkhalter Java Multimedia, Imaging, and Graphics Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~







