conversion of jpeg to svg in android - android

I want to know how to convert jpeg files to svg files in android?
Thank you in advance. Or can I convert pdf into svg format?

JPEG is a raster/bitmap format. SVG is a vector format. Going from bitmap to vector is not a trivial task, as a vector format describes shapes and attributes in an XML format. At the very best, a vector representation of a bitmap would be wildly inefficient.
Perhaps you can give an idea of what you are trying to do, and someone can help with the larger problem?

Related

How to compress GIF image before uploading to server in android?

how to compress GIF image before upload it to the server ?, i tried some android libraries to compress gif image but it convert it to png image. is there any way to compress gif image ?
im using a bitmap in my projects.
Bitmap
Example code:
ImageView carView = (ImageView) v.findViewById(R.id.imagen_cr7);
byte[] decodedString = Base64.decode(picture, Base64.NO_WRAP);
InputStream input=new ByteArrayInputStream(decodedString);
Bitmap ext_pic = BitmapFactory.decodeStream(input);
carView.setImageBitmap(ext_pic);
GIF is a lossless image compression format: it is set up to reproduce the image exactly.
As a consequence, there is no "image quality" slider (as in JPEG encoders); although a GIF will likely be much smaller than an uncompressed format (such as many camera RAW or common TIFF options), there is a limit to how far it can go.
Also, you should know that GIF is limited to 8 bits per pixel (so it is most appropriate for line art, not photo-like images). If your source image is a full 24 bits, it must be dithered to fit into a 256-entry color palette. So, although the GIF format itself is lossless, the image processing required to use it in the first place may be lossy.
There are a number of things you can do to reduce the size of your image file:
You can choose a lossy format (such as JPEG), which will allow much greater compression. Note that JPEG works well on photo-like images, but not so well on line art. Also, (although your question explicitly rejects it) PNG may be a reasonable option, as it (losslessly) supports 24-bpp images.
As mentioned in a comment, you can try reducing the resolution of your image, and shipping the reduced version. If you can't generate a smaller image to start with, image resizing typically works well on photo-like images, and there are nonlinear resizing filters available that are specifically intended to handle line art.
If a full-resolution GIF is mandatory for your application, you may be able to generate an image that is more compressible by the GIF format. GIF compresses solid blocks of color extremely well -- but does less well on dithered or noisy images (such as you might get from converting a 24-bpp image to GIF format).
Since you have not given any information on your requirements (what kind of image you have, where you got it, and what you need it for), it is hard to come up with specific advice.
However, there is a good chance that your GIF has far more resolution than you need for your particular application (leading to option #2).

Convert svg to webp

How can I convert an svg file to webp using Android Studio?
I don't see any convert to webp option when right clicking on the xml file and when I tried an online converter it produced 1 webp file while I was expecting a file for each definition folder drawable-*dpi
Also I don't see how I could import the webp in the project if I converted it from another tool.
SVG is a vector graphic where WebP is a raster graphic. These graphic types are not compatible. You first need to convert the SVG to some sort of raster graphic. You can do this by simply taking a screen shot of the image. Then convert the screenshot from what ever raster format (usually PNG) to WebP.

how to extract frames of an animated .gif file in android

I want to extract all frames(images) of an animated .gif file as bitmap or Drawable or any common type of image and store all images in an array in android. How i do it?
please help me.

Android RBG image file to CMYK image File

I have many images in RGB format. I need to convert them to CMYK format and save them (no need to display the CMYK image on screen) to a file. I found many answers for converting RGB value to CMYK value but I dont know what to do with those CMYK values.I need to convert the whole RGB file and save it as CMYK file. How do I do that ?

SVG image not display

i have converted a psd file into svg, it works good at browser but not works on android native applications, how can i do this?
ImageView imageView = (ImageView)findViewById(R.id.img1);
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.android);
//Get a drawable from the parsed SVG and apply to ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
This is the code i used to display svg image. it works when i used simple svg images, but it not works converted svg images using illustrator . how can i do?
I am guessing that your SVG just contains the image from the PSD. Is that the case?
If all that the SVG contains is a bitmap image, then you are not really using SVGs for their proper purpose (vector art). You would be better off just converting the PSD to a JPEG or PNG and loading that into an ImageView.
However, if you are definitely sure you want to load an SVG, then the solution depends on which SVG library you are using.
svg-android: As far as I know, it doesn't support <image> elements, so there is no solution
AndroidSVG: supports <image>, so it should work as long as the device has the memory to load the image. If the image is embedded in the file, you should be fine. If it references an external image, you will need to pass in an SVGExternalFileResolver so it knows how to find the bitmap. See my answer to the following question: https://stackoverflow.com/a/21531168/1292848

Categories

Resources