How would I convert a PNG Image into a byte array? - gwt

Using GWT I would like to read a PNG image and have the data accessible to me as a decoded byte array.
On the client side I get the image using an ImageBundle, I then instantiate an Image and call setUrl.
At this point, how do I get the image byte array from the image?

You can't. Javascript (and hence GWT) do not have access to images' data when images are presented as html images (i.e. as <img> tag or css background image).
What you could do is load image data via RPC, process it, Base64 encode it and then create image via embedded url: "data:image/png;base64,..yourBase64Datahere.."
If you are trying to do some visual manipulation you should consider:
Manipulating image on the server.
Using html canvas or svg.

Related

Image is getting rotated automatically by 90 degree in a web page

My code is just this:
<img src="uploads/619671548171334115-961656431.jpg" alt="a">
You can see this here yourself:
https://moviesre.com/ogb/addtestimonial/testtt.php
This is the image: https://moviesre.com/ogb/addtestimonial/uploads/619671548171334115-961656431.jpg
See it is not flipped, but in the web page it is displaying flipped. What's up?
Edit: Not all images are getting roated on this server. Some images with smaller file size (in pixel not memory) are displaying normal
Maybe your uploaded image is rotated, but is being corrected because it contains rotation data in its EXIF ('Exchangeable Image File Format' is all the information that is automatically embedded into an image file when a photo is taken using a modern digital camera) section.
You can see EXIF data of your local file from exifdata.com and also you can see EXIF data of your uploaded file (that server is providing to the browser) by using php function exif_read_data()
You can get full explanation this answer of #matt-gibson

AlamofireImage: Is it possible to get the raw data from an NSimageview in Swift?

I am using an imagewell to accept jpg images being pasted or dragged into my OSX app. The problme is that I am struggling to get the original jpg images as OSX seems to requires me to get the Tiff version of the NSImage if I want to uplod via Alamo Fire.
Does AlamoFireImage have a fancy way of getting the original url / original raw data without converting to Tiff first?
Actually, with an NSImageWell, you don't have much possibilities regarding the dropped image. It's a convenient class for showing dropped images but as soon as you need to do more, it's not up to the task.
I suggest you use an NSImageView instead, and add drag and drop capabilities to it like in my example here: https://stackoverflow.com/a/29233824/2227743
This way you can easily get the dropped image's URL (and filename), and the image data itself of course.

Create pdf in proper format

I want to create PDF with proper format like proper text and image would be on proper format like normal PDF file.
I know how to create PDF with image and text but I don't know how to format it & I also know that PDF can be converted from HTML by displaying it's content on webview and capturing its screen in image and converting it into PDF.
But is there any another way or any tag available like HTML.
Or is there any third party tool available for this issue.
You can create a PDF drawing contect with CGPDFContextCreate and then draw with standard Cord Graphics 2D functions as you would draw on the screen. See also this question: iOS SDK - Programmatically generate a PDF file

How does One place an image inside of an image using metadata?

For example, I can convert the second image into NSData and then place it inside metadata inside the first image and then when I open the first image and read the metadata I can get the NSData and turn it into an UIImage.
How would I go about doing this? All the metadata tags I see are not large enough to support another picture. I know picture in picture is quite common on desktop apps so I'm interested in getting it to work on the iPhone.
Is metadata the correct way to do this or is there another way?

Store images in a plist

I obtain seven thumbnail images from my one PDF melodramatically, and these seven images are stored in one array as objects. Now i want to show the images in the array in a UIWebView, but it is not possible because the web view needs a path to a resource or a plist path. So I want to store these images in a plist; how can I do this?
In my array, only the image objects are available, not the names, and all seven images are not static images.
I am new in iPhone programming, so please tell me how I can do this?
Your question does not make much sense to me (melodramatically?). Contrary to what you believe, UIWebView cannot deal with a property list. What would it be supposed to do with it? A web view can display data from a URL request, a string of HTML or a bunch of data in a specified format.
In your case, the latter would apply: convert one of your images into an NSData object (with UIImagePNGRepresentation()) and pass it to the web view with -loadData:MIMEType:textEncodingName:baseURL:.
If you want to display all images at once, you would have to save the images to disk and generate appropriate HTML code.