How to create thumbnail of a video? - java

I have a jsp page for users to upload video.
I am able to store uploaded video as blob in datastore
but I want to create thumbnail from the uploaded video as well.
How do I create the thumbnail?

Depending of classes which you use to operate over MIME objects in Java, you should be able to obtain random frame from the video (let's say as BufferedImage) and then resize it to desired thumbnail size.

Related

How to remove Thumbnail form Image using ExifInterface

I want to REMOVE the Thumbnail image after take a picture. I used the camera intent to launch the camera, passing the file Uri.
I've been looking for some documentation about how to Delete the thumbnail. All small examples I've seen is just to retrieve the current metadata tags, but not how to delete it.
ExifInterface only have function ExifInterface.setAttribute(String, String) But which one is the TAG to point null data to delete it or something similar?
Im using the support version of Exifinterface.
com.android.support:exifinterface:25.3.1

Do I have to physically save image in order to display it in JSP?

I have an image on top of which I need to add different text based on url parameter. I'm planning to do this with Graphics2D/BufferedImage.
The question is, do I have to save image to disk in order to show it in JSP to the user? The purpose of the image is only be displayed and I'd rather not to save thousands of the images that will be generated...
Thanks!
You do not have to save the image to disk. You can use a bare-bones vanilla servlet to generate the BufferedImage, and then use ImageIO.write() to write that image to the response.getOutputStream(). Just make sure you set the headers to the correct content-type. Then, in the HTML generated by the JSP, just use the URL of the servlet as the src for the img tag.
You can base64 encode the image and chuck it onto the page. Browsers won't cache it, though.
Embedding Base64 Images
https://en.wikipedia.org/wiki/Data_URI_scheme#Web_browser_support

How to Merge a background Image and the HTML Content as one downloadable Image

Thanks in Advance. I am working on JSP Platform and I have a requirement wherein I need to provide a membership card which will have an image as the Background with all the details like name, telephone number, Membership ID and other personal details. All these details will be captured in a form and then displayed over the card image with the details.
But when the html form is submitted the data is saved in MYSQL and the JSP page displays the Card with the details on its desired position. What I am looking at is that is there a way to make that card image along with the details appear as an image which the user can directly download coz now if the user is trying to download he just gets the Blank background image without any data. Is there a way to merge the card image and the data as a single image or something which can easily be downloaded and also sent as an image to the users email.
You want something like a screenshot, right?
Here a tool to convert HTML source to pdf:
http://wkhtmltopdf.org/
This post can also help:
Convert web page to image

Resize static image file in Google App Engine

I have uploaded a static image (e.g., at location: /images/no-image.jpg) as part of my code that gets used as the default image when there is no specific image available (basically of the type: "no image for this item")
Just realized that this image may have to be served at more than one size (I have uploaded -- and want to upload -- just one size).
How do I resize this image using Google's Images Service?
If I use the example shown at https://developers.google.com/appengine/docs/java/images/#Java_Transforming_images_in_Java , that means having to read the file, apply the transform, then write a servlet to serve up the file... which seems like a lot of work. Is there an easier way?
Will it be easier to just upload the image to the BlobStore :-)?
You can add the following lines to your CSS file:
.placeholder {
background-image:url('../images/bg.png');
background-repeat:no-repeat;
background-size:contain;
background-position:center;
}
Now, when you don't have a specific image to serve, simply add "placeholder" class to your container element.
Remember to make this image cacheable.
I strongly recommend using the getServingUrl function for serving and resizing images for two reasons:
simpler to use. to resize, you just append parameters to the image url
It will significantly reduce the load off your instances, since the images are served without a servlet, but with google magic

When saving an image as BLOB how to display it in JSP with text?

I have done a lot of googling but I have not been able to find a concrete answer.
I am using Spring MVC 3 to save a user image to the database. I am now successfully able to do that. I am saving the image as a BLOB.
I can retrieve the image as a byte[].
Irregardless of file type - jpg, png, gif etc (My image upload is image file type agnostic) I would like to allow jpg and gif and png lets say to render i.e. my display technology should not be hard-coded to display just one type of image, say jpg, it should be able to display all images as they were uploaded in their respective types - that is the requirement.
NOW, I would like to do 2 things
re-size the image if I have to. ie.
200 by 200
render the image in a JSP WITH text.
This is a user profile page so I
need to have both text and image
shown.
How can spring mvc render the image WITH text?
I understand from my research that you can use a BufferedImage type for the jsp? but my problem is that it seems that you can only use that if the content type is strictly image/jpeg, image/gif.
I have come across some links for resizing:
http://forum.springsource.org/archiv...p/t-46021.html
any suggestions welcome if these work BUT ultimately I need to display the image.
Please pass your thoughts along.
Thank you.
Just create a servlet which streams the image from the DB to the outputstream of the response. Then you can just call it the usual HTML way as follows:
<p>
<img src="imageservlet/${bean.imageId}" />
${bean.text}
</p>
As you see, you just display the text next to the image in HTML. You cannot mix them in a single HTTP response anyway. Images counts as separate HTTP requests. For more detail and a kickoff code example of such a servlet, check this answer.
As to resizing, checkout the Java 2D API.

Categories

Resources