Class ImageRenderUtils
- java.lang.Object
-
- com.atlassian.confluence.content.render.image.ImageRenderUtils
-
public class ImageRenderUtils extends Object
Convenient utility methods for rendering of images.- Since:
- 5.3
-
-
Constructor Summary
Constructors Constructor Description ImageRenderUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImageDimensions
dimensionsForImage(InputStream is)
static ImageDimensions
dimensionsForImage(ImageInputStream inputStream)
Helper class that uses anImageReader
to determine the width and height of an image.static void
writePngToStream(BufferedImage image, javax.servlet.http.HttpServletResponse response)
Write theimage
(expected to be a PNG image) to the servlet output stream of the response.
-
-
-
Method Detail
-
dimensionsForImage
public static ImageDimensions dimensionsForImage(ImageInputStream inputStream) throws IOException
Helper class that uses anImageReader
to determine the width and height of an image.Doesn't rasterize the whole image and works well even with very large images (e.g. 15,000 x 15,000 px).
- Throws:
IOException
-
dimensionsForImage
public static ImageDimensions dimensionsForImage(InputStream is) throws IOException
- Throws:
IOException
-
writePngToStream
public static void writePngToStream(BufferedImage image, javax.servlet.http.HttpServletResponse response) throws IOException
Write theimage
(expected to be a PNG image) to the servlet output stream of the response.This method will flush and close the servlet output stream.
- Parameters:
image
- The PNG that will be written to the servlet responseresponse
- HttpServletResponse- Throws:
IOException
- if the image cannot be written, or if it cannot be flushed.- See Also:
- Tomcat ImageIO Issues,
ResponseOutputStreamFilter
-
-