I used the PDFImageWriter class to convert a PDF to an image file (png). Now I want to crop the images (images) from the converted image file. I do not know how to do that? Can someone provide some code for this?
Perhaps it will work.
private BufferedImage cropImage ( BufferedImage src , Rectangle rect ) { BufferedImage dest = src.getSubimage ( rect.x , rect.y , rect.width , rect.height ) ; return dest ; }
If you are trying to crop the image using Java, then this may answer your question: java image crop
If you are trying to extract images from PDF, this may answer your question: How to extract images from pdf using Java (without using pdfbox)