Package org.apache.xmlgraphics.image.writer

Examples of org.apache.xmlgraphics.image.writer.ImageWriter.writeImage()


            //TODO Revisit after the image library redesign!!!
            //Convert the decoded bitmaps to a BufferedImage
            BufferedImage bufImage = createBufferedImageFromBitmaps(fopImage);
            ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor("image/png");
            ByteArrayOutputStream baout = new ByteArrayOutputStream();
            writer.writeImage(bufImage, baout);
            rawData = baout.toByteArray();
        }
        if (rawData == null) {
            log.warn(FONode.decorateWithContextInfo("Image could not be embedded: "
                    + fopImage.getOriginalURI(), abstractGraphic));
View Full Code Here


                    + " loading problem.");
        }
        if (log.isDebugEnabled()) {
            log.debug("Writing image using " + writer.getClass().getName());
        }
        writer.writeImage(image, os, params);
    }

    /**
     * Returns the OutputStream corresponding to this page
     * @param pageNumber 0-based page number
View Full Code Here

                }
            } finally {
                multiWriter.close();
            }
        } else {
            writer.writeImage((RenderedImage) pageImagesItr.next(), outputStream, writerParams);
            if (pageImagesItr.hasNext()) {
                log.error("Image encoder does not support multiple images. Only the first page"
                        + " has been produced.");
            }
        }
View Full Code Here

     */
    public static void saveAsPNG(RenderedImage bitmap, File outputFile) throws IOException {
        OutputStream out = new FileOutputStream(outputFile);
        try {
            ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor("image/png");
            writer.writeImage(bitmap, out);
        } finally {
            IOUtils.closeQuietly(out);
        }
    }
   
View Full Code Here

            ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(format);
            ImageWriterParams params = new ImageWriterParams();
            params.setCompressionMethod(compression);
            params.setResolution(72);
            writer.writeImage(bimg, out, params);
           
        } finally {
            IOUtils.closeQuietly(out);
        }
    }
View Full Code Here

            throw new ImageException("Cannot convert image to PNG. No suitable ImageWriter found.");
        }
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        ImageWriterParams params = new ImageWriterParams();
        params.setResolution((int)Math.round(src.getSize().getDpiHorizontal()));
        writer.writeImage(rendered.getRenderedImage(), baout, params);
        return new ImageRawStream(src.getInfo(), getTargetFlavor(),
                new java.io.ByteArrayInputStream(baout.toByteArray()));
    }

    /** {@inheritDoc} */
 
View Full Code Here

                    + " loading problem.");
        }
        if (log.isDebugEnabled()) {
            log.debug("Writing image using " + writer.getClass().getName());
        }
        writer.writeImage(image, os, params);
    }

    /**
     * Returns the OutputStream corresponding to this page
     * @param pageNumber 0-based page number
View Full Code Here

                }
            } finally {
                multiWriter.close();
            }
        } else {
            writer.writeImage((RenderedImage) pageImagesItr.next(), outputStream, writerParams);
            if (pageImagesItr.hasNext()) {
                log.error("Image encoder does not support multiple images. Only the first page"
                        + " has been produced.");
            }
        }
View Full Code Here

            ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(format);
            ImageWriterParams params = new ImageWriterParams();
            params.setCompressionMethod(compression);
            params.setResolution(72);
            writer.writeImage(bimg, out, params);

        } finally {
            IOUtils.closeQuietly(out);
        }
    }
View Full Code Here

            throw new ImageException("Cannot convert image to PNG. No suitable ImageWriter found.");
        }
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        ImageWriterParams params = new ImageWriterParams();
        params.setResolution((int)Math.round(src.getSize().getDpiHorizontal()));
        writer.writeImage(rendered.getRenderedImage(), baout, params);
        return new ImageRawStream(src.getInfo(), getTargetFlavor(),
                new java.io.ByteArrayInputStream(baout.toByteArray()));
    }

    /** {@inheritDoc} */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.