It’s possible to convert an Image object To FormFile object ..?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you referring to the Apache Struts
FormFile? If so, then you’d probably want to be creating aCommonsMultipartRequestHandler.CommonsFormFilewhich simply wraps an implementation of theFileIteminterface, the only one of which I could find (that isn’t deprecated) is aDiskFileItem. But this is for content that’s been received within a multipart/form-data POST request, and not something that I would have thought you’d have anImageobject for. Which makes me wonder what exactly you’re trying to accomplish.update:
Based on your feedback I would imagine you could create a
BufferedImageobject based on theFileItem, which should then be able to be manipulated:Once you’re happy with the BufferedImage that you’ve tweaked you can write it to the file system using
ImageIO.write().