Android: converting string to image and saving to gallery - java

In my project I need to save a JPG image to android gallery. Unfortunately, Unity tools do not provide such function in-the-box, so I must implement this function myself. As far as I know, I need to make a little plugin to do that and already figured how to make a simple plugin, but I have questions about my specific goal.
So, the main part is: I have texture in Unity, I encode it to JPG format, resulting in a byte array. Then I convert this byte array into a string to be able to pass this string via android bridge into method located in a java class. Everything that's going to happen further is a black box for me.
I know the basic theory: I need to convert the string into an image somehow, specify the folder for the pictures of my app, save the image into this folder, and somehow refresh device memory so the image is visible in the gallery. But the implementation is a big mystery for me. I know it can be done after a few days of digging, but I guess that this can be done in one-two simple methods.
Can anybody give me some hints? Are there any issues between conversion from C# code in Unity into Java code in, for example, Eclipse?

Related

Convert string text to GCode

I need to create an app (using Android Studio) that generates CNC code to operate a 3D printer. It takes a String as input.
I've found a couple libraries in Python and Javascript that does this, but as I don't have time to translate whole libraries to Java, can you recommend any libraries that does that for me? If there are no open-source options, can you recommend any guide to help me develop this conversor?
What we ended up doing:
App asks for a String as input;
String is converted to a bitmap and then saved as a .png;
.png is loaded and converted to a .svg file. We used this repo: https://github.com/jankovicsandras/imagetracerandroid
We developed a parser to convert a .svg to g-code.
It worked but it's not the best solution, we're looking to implement something that runs python in Android, as there are many pythons that do all the work already, but that's how we've done it and it's working by now.

Basic image manipulation (open, copy, crop, paste) in Java or Android

I'm creating an android apps that use basic image manipulation (open image,copy, crop, paste).
Basically, the program will have multiple image input and it will be manipulated(copy, crop, paste). Then, an output image will be saved. I had done this in python using PIL library and would like to do the same using Java.
So, how do i do this in? Can someone point me a good library that have all the features? Thanks.
Hope this makes your work on this easy. I was going through some links and found this.
Let me know if you need anything else. Thanks.Image Manipulation in Java

Using SimpleXML to send images between Android and Java

Today I'm presented with a challange of writing an XML that will hold image files. I don't know how to go about this but I need to have an image on Java and that will use SimpleXML write method to send an image from one Socket to the Socket in Android.
Is this possible?
I've tried looking around but I seem to have trouble with that.
If this is possible, is it also possible to use other multimedia?
After extensive research I have solved this problem by creating a ByteArray in SimpleXML, putting the image into the byte array in Java and then recreating it as bitmap in android using bitmap factory. Hope this helps anyone in their future endeavors.

Extracting image pixel values in google appengine

I am working on google appengine to create a tool for comparing image similarity.
I need to extract the pixel values of each image to perform this.
Unfortunately appengine does not support the java image libs.So I am unable to proceed.
Is there any appengine safe image library in java capable of extracting image data?
I saw some techniques in python but dont want to switch to python if I can do it in java somehow...
GAEJ has its own graphic library with fairly limited features and java.awt.image.BufferedImage is a restricted class (ie, java.awt.Image is not supported and still not present in the Jre Class White List ).
There's an open issue here, that you might want to star.
EDIT:
Somebody has patched pngj to work with InputStream.(You could use it to read a PNG pixel by pixel)
The new version of pngj now an alternative pngj-sandbox.jar that only references whitelisted classes, it should run in google-app-engine.
can https://github.com/witwall/appengine-awt help to you? i believe it willbe enough to add theis lib as dependency to the project to make BufferedImage working (but havent' tried this yet)

Java: Make an animation/video from frames

Howdy! For a research project (in Java), I've got to find some way to save an animation of a graph into some file format. Now I've already got the program working fine drawing each frame. The problem is, short of learning the whole GIF or AVI file format, I have no idea how to assemble the frames programmatically into some sort of animation or video file. File formats don't really matter--input or output. I just need some way to put the frames together and save!
Right now I'm thinking the easiest format would be either animated GIF or AVI. Again, though, it really doesn't matter so long as it works.
Thanks a bunch!
They might not be the best options, but I just thought of these:
You might be able to use some QuickTime APIs. I know they're used fairly often for webcam input, and that they can also generate video.
You could also generate each frame and then assemble them with ffmpeg.
Try Xuggler -- it'll let you save graphics into pretty much any video format.

Categories