public static void displayImageInfo(ImageInfo info) { ImageSize size = info.getSize(); Dimension2D dPt = size.getDimensionPt(); Dimension dPx = size.getDimensionPx(); log.debug(info.getOriginalURI() + " " + info.getMimeType() + " " + Math.round(dPx.getWidth()) + "x" + Math.round(dPx.getHeight())); log.debug("Resolution:" + Math.round(size.getDpiHorizontal()) + "x" + Math.round(size.getDpiVertical())); log.debug("Print size: " + Math.round(dPt.getWidth() / 72) + "\" x" + Math.round(dPt.getHeight() / 72) + "\""); }
public static CxCy scale(ImageInfo imageInfo, double xEmu, double yEmu) { ImageSize size = imageInfo.getSize(); double iwEmu = toEmu(size.getWidthPx(), size.getDpiHorizontal()); double ihEmu = toEmu(size.getHeightPx(), size.getDpiVertical()); return scaleToFit(iwEmu, ihEmu, xEmu, yEmu); }
/** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Size: "); sb.append(getWidthMpt()).append('x').append(getHeightMpt()).append(" mpt"); sb.append(" ("); sb.append(getWidthPx()).append('x').append(getHeightPx()).append(" px"); sb.append(" at ").append(getDpiHorizontal()).append('x').append(getDpiVertical()); sb.append(" dpi"); sb.append(")"); return sb.toString(); }
public static void displayImageInfo(ImageInfo info) { ImageSize size = info.getSize(); Dimension2D dPt = size.getDimensionPt(); Dimension dPx = size.getDimensionPx(); log.debug(info.getOriginalURI() + " " + info.getMimeType() + " " + Math.round(dPx.getWidth()) + "x" + Math.round(dPx.getHeight())); log.debug("Resolution:" + Math.round(size.getDpiHorizontal()) + "x" + Math.round(size.getDpiVertical())); log.debug("Print size: " + Math.round(dPt.getWidth() / 72) + "\" x" + Math.round(dPt.getHeight() / 72) + "\""); }
Element child; double dpiHorz = size.getDpiHorizontal(); double dpiVert = size.getDpiVertical(); child = getChild(dim, "HorizontalPixelSize"); if (child != null) {
private void updateIntrinsicSize(AFPImageObjectInfo imageObjectInfo, AFPPaintingState paintingState, ImageSize targetSize) { //Update image object info imageObjectInfo.setDataHeightRes((int)Math.round( targetSize.getDpiHorizontal() * 10)); imageObjectInfo.setDataWidthRes((int)Math.round( targetSize.getDpiVertical() * 10)); imageObjectInfo.setDataHeight(targetSize.getHeightPx()); imageObjectInfo.setDataWidth(targetSize.getWidthPx()); // set object area info int resolution = paintingState.getResolution(); AFPObjectAreaInfo objectAreaInfo = imageObjectInfo.getObjectAreaInfo(); objectAreaInfo.setResolution(resolution); }
public static CxCy scale(ImageInfo imageInfo, double xEmu, double yEmu) { ImageSize size = imageInfo.getSize(); double iwEmu = toEmu(size.getWidthPx(), size.getDpiHorizontal()); double ihEmu = toEmu(size.getHeightPx(), size.getDpiVertical()); return scaleToFit(iwEmu, ihEmu, xEmu, yEmu); }
sourceResolution *= 1000; //we're working in the millipoint area sx *= sourceResolution / info.getSize().getDpiHorizontal(); sy *= sourceResolution / info.getSize().getDpiVertical(); at.scale(sx, sy); RenderedImage rend = imageRend.getRenderedImage();
effIntrinsicSize.getDpiHorizontal() * 10)); imageObjectInfo.setDataWidthRes((int)Math.round( effIntrinsicSize.getDpiVertical() * 10)); imageObjectInfo.setDataHeight(effIntrinsicSize.getHeightPx()); imageObjectInfo.setDataWidth(effIntrinsicSize.getWidthPx());
public static void readPNGHeader(ImageInputStream inputStream, ImageSize size) throws IOException { SeekableStream seekStream = new ImageInputStreamSeekableStreamAdapter(inputStream) { public void close() throws IOException { } }; PNGImage pngImage = new PNGImage(seekStream); size.setSizeInPixels(pngImage.getWidth(), pngImage.getHeight()); double dpiHorz = size.getDpiHorizontal(); double dpiVert = size.getDpiVertical(); if (pngImage.unitSpecifier == 1) { if (pngImage.xPixelsPerUnit != 0) { dpiHorz = pngImage.xPixelsPerUnit * 0.0254; } if (pngImage.yPixelsPerUnit != 0) { dpiVert = pngImage.yPixelsPerUnit * 0.0254; } } size.setResolution(dpiHorz, dpiVert); size.calcSizeFromPixels(); } }
ditherBitmapSize.getDpiHorizontal() * 10)); imageObjectInfo.setDataWidthRes((int)Math.round( ditherBitmapSize.getDpiVertical() * 10)); imageObjectInfo.setDataWidth(ditherSize.width); imageObjectInfo.setDataHeight(ditherSize.height);
double sy = pos.getHeight() / info.getSize().getHeightMpt(); sx *= userAgent.getSourceResolution() / info.getSize().getDpiHorizontal(); sy *= userAgent.getSourceResolution() / info.getSize().getDpiVertical(); at.scale(sx, sy); state.getGraph().drawRenderedImage(imgRend.getRenderedImage(), at);
private void updateDataObjectInfo(AFPDataObjectInfo dataObjectInfo, ImageRawStream rawStream, AFPResourceManager resourceManager) throws IOException { dataObjectInfo.setMimeType(rawStream.getFlavor().getMimeType()); AFPResourceInfo resourceInfo = dataObjectInfo.getResourceInfo(); if (!resourceInfo.levelChanged()) { resourceInfo.setLevel(resourceManager.getResourceLevelDefaults() .getDefaultResourceLevel(ResourceObject.TYPE_IMAGE)); } InputStream inputStream = rawStream.createInputStream(); try { dataObjectInfo.setData(IOUtils.toByteArray(inputStream)); } finally { IOUtils.closeQuietly(inputStream); } int dataHeight = rawStream.getSize().getHeightPx(); dataObjectInfo.setDataHeight(dataHeight); int dataWidth = rawStream.getSize().getWidthPx(); dataObjectInfo.setDataWidth(dataWidth); ImageSize imageSize = rawStream.getSize(); dataObjectInfo.setDataHeightRes((int) (imageSize.getDpiHorizontal() * 10)); dataObjectInfo.setDataWidthRes((int) (imageSize.getDpiVertical() * 10)); }