Convert SVGImage in JPEGEncodedImage

Hello

Is there a way to convert SVGImage to JPEGEncodedImage. Please provide some piece of code.

Thanks in advance.

Sridhar


Tags: BlackBerry Developers

Similar Questions

  • Convert Image into JPEGEncodedImage

    Is it possible to convert an Image in JPEGEncodedImage?

    Thank you!

    I think that I thought about it, but havn't tried.

    Create a Bitmap image, and then use it to create a Graphics object.

    Take a look at the level of the SVG file in samples of the JDE. It's the svgcldcdemo. Basically to rewrite it so that you get your SVGImage, then instead of paint called do you it manually. This will draw the SVGImage for graphics and so the Bitmap image.

    Then call JPEGEncodedImage.encode and pass the Bitmap. Walla, a SVGImage to a JPEGEncodedImage.

    Hope that helps.

  • How to convert the object Bitmap to byteArray.

    Hi all

    I had a problem in the conversion of the bitmap object to. BMP file.

    (Real need: capture the screen shot and convert that turned to the screen.) BMP image and I have to keep this image in the SCARD

    I shouldn't use any PNGEncodedImage or JPEGEncodedImage )

    I capture the screen shot using the

    Bitmap BM = new Bitmap (width, height);

    Display.screenshot (WB);

    to get the data from [] bytes of this bitmap object that I use

    Byte [] _bytes = getBytesFromBitmap (bitmap);

    public byte [] getBytesFromBitmap (Bitmap bmp) {}
    try {}
    int height = bmp.getHeight ();
    int width = bmp.getWidth ();
    int [] rgbdata = new int [width * height];
    ByteArrayOutputStream Bos = new ByteArrayOutputStream();
    DataOutputStream back = new DataOutputStream (bos);
    Graphics g = new Graphics (bmp);
    bmp.getARGB(rgbdata,0,width,0,0,width,height);
    for (int i = 0; i)< rgbdata.length="" ;="" i++)="">
    If (rgbdata [i]! = - 1) {}
    dos.writeInt (i);
    back. Flush();
    //l++;
    }
    }
    Bos.Flush ();
    Return bos.toByteArray ();
    }
    catch (Exception ex) {}
    Dialog.Alert ("getBytesFromBitmap:" + ex.toString ());
    Returns a null value.
    }

    If I use this byte array in the Sub statement I get the "IllegalArgumentException".

    BMPEncodedImage.createEncodedImage (_bytes, 0, _bytes .length);

    all can help me how I can get the byte [] data from the bitmap object?

    import java.io.ByteArrayOutputStream;import java.io.DataOutputStream;import java.io.IOException;
    
    import javax.microedition.lcdui.Image;
    
    /** * @author Samuel Halliday */public final class BMPGenerator {
    
        /**     * @param image     * @return     * @throws IOException     * @see {@link #encodeBMP(int[], int, int)}     */    public static byte[] encodeBMP(Image image) throws IOException {        int width = image.getWidth();        int height = image.getHeight();        int[] rgb = new int[height * width];        image.getRGB(rgb, 0, width, 0, 0, width, height);        return encodeBMP(rgb, width, height);    }
    
        /**     * A self-contained BMP generator, which takes a byte array (without any unusual     * offsets) extracted from an {@link Image}. The target platform is J2ME. You may     * wish to use the convenience method {@link #encodeBMP(Image)} instead of this.     * 

    * A BMP file consists of 4 parts:- *

      *
    • header
    • *
    • information header
    • *
    • optional palette
    • *
    • image data
    • *
    * At this time only 24 bit uncompressed BMPs with Windows V3 headers can be created. * Future releases may become much more space-efficient, but will most likely be * ditched in favour of a PNG generator. * * @param rgb * @param width * @param height * @return * @throws IOException * @see http://en.wikipedia.org/wiki/Windows_bitmap */ public static byte[] encodeBMP(int[] rgb, int width, int height) throws IOException { int pad = (4 - (width % 4)) % 4; // the size of the BMP file in bytes int size = 14 + 40 + height * (pad + width * 3); ByteArrayOutputStream bytes = new ByteArrayOutputStream(size); DataOutputStream stream = new DataOutputStream(bytes); // HEADER // the magic number used to identify the BMP file: 0x42 0x4D stream.writeByte(0x42); stream.writeByte(0x4D); stream.writeInt(swapEndian(size)); // reserved stream.writeInt(0); // the offset, i.e. starting address of the bitmap data stream.writeInt(swapEndian(14 + 40)); // INFORMATION HEADER (Windows V3 header) // the size of this header (40 bytes) stream.writeInt(swapEndian(40)); // the bitmap width in pixels (signed integer). stream.writeInt(swapEndian(width)); // the bitmap height in pixels (signed integer). stream.writeInt(swapEndian(height)); // the number of colour planes being used. Must be set to 1. stream.writeShort(swapEndian((short) 1)); // the number of bits per pixel, which is the colour depth of the image. stream.writeShort(swapEndian((short) 24)); // the compression method being used. stream.writeInt(0); // image size. The size of the raw bitmap data. 0 is valid for uncompressed. stream.writeInt(0); // the horizontal resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the vertical resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the number of colours in the colour palette, or 0 to default to 2n. stream.writeInt(0); // the number of important colours used, or 0 when every colour is important; // generally ignored. stream.writeInt(0); // PALETTE // none for 24 bit depth // IMAGE DATA // starting in the bottom left, working right and then up // a series of 3 bytes per pixel in the order B G R. for (int j = height - 1; j >= 0; j--) { for (int i = 0; i < width; i++) { int val = rgb[i + width * j]; stream.writeByte(val & 0x000000FF); stream.writeByte((val >>> 8 ) & 0x000000FF); stream.writeByte((val >>> 16) & 0x000000FF); } // number of bytes in each row must be padded to multiple of 4 for (int i = 0; i < pad; i++) { stream.writeByte(0); } } byte[] out = bytes.toByteArray(); bytes.close(); // quick consistency check if (out.length != size) throw new RuntimeException("bad math"); return out; } /** * Swap the Endian-ness of a 32 bit integer. * * @param value * @return */ private static int swapEndian(int value) { int b1 = value & 0xff; int b2 = (value >> 8 ) & 0xff; int b3 = (value >> 16) & 0xff; int b4 = (value >> 24) & 0xff; return b1 << 24 | b2 << 16 | b3 << 8 | b4 << 0; } /** * Swap the Endian-ness of a 16 bit integer. * * @param value * @return */ private static short swapEndian(short value) { int b1 = value & 0xff; int b2 = (value >> 8 ) & 0xff; return (short) (b1 << 8 | b2 << 0); } } Found form the Link mentioned below:
    http://javablog.co.uk/2007/12/26/j2me-bitmap-encoder/
  • JPEGEncodedImage.encode () does not

    Hello

    I want to save a bitmap object to an image file. To do this, I'm trying to convert the bitmap image into a byte array. After going through many forums, I've decided to use JPEGEncodedImage.getData ().

    I develop using BB JDE 4.6.0 but when I type the following line:

    Bitmap bm = new Bitmap (Width, Height);
               
    Display.screenshot (WB);
    Jpg JPEGEncodedImage = new JPEGEncodedImage.encode(bm,29);

    but I get the error message: "cannot find symbol-> encode class.

    It's really frustrating, because the intellisense shows clearly that this method is available for the class of JPEGEncodedImage...

    Can someone help me please.

    Thank you very much!

    Saket

    Hello

    coding is a static method in the JPEGEncodedImage class. Give a glance at the doc in the api for more details.

    Then try this:

    JPEGEncodedImage jpg = JPEGEncodedImage.encode(bm,29);
    

    Concerning

    Bika

  • So with the new update every attachment I get an Outlook user is converted in a winmail.dat file.  How Apple could make a such big screw-up?  Even when I check gmail via apple mail conversion is made, but if I connect to google, the files are

    Why is each attachment outlook, I get in the Mail now converted in a winmail.dat file?  I don't want to go make an app to allow me to open these files - it is something stupid on the part of Apple - please correct!

    Tell Apple - http://www.apple.com/feedback/

  • Convert AAC to MP3 Itunes - 10 Windows files

    ITunes Version 12.5.1

    Windows 10

    I would like to convert AAC to MP3 audio files.  How can it be done?  I would like to transfer my songs on a flash drive to plug into my car audio system to play my songs.  The interesting thing is that on my drive hard it shows that the music file is MPEG-4 audio type - this type of file will play on stereo car if I copy these files directly to a flash drive.

    There was a time when we could select all the songs, right click and select Convert to MP3.

    Thank you, in advance for your answer.

    (NOTE: the songs are already on my drive hard and do not intend to import them again)

    (NOTE 2: If someone used AnyTans - for Windows?) If so, what are your thoughts on his performance?)

    MPEG-4 audio is another description for files to AAC format or .m4a.

    Import or convert the format is defined in Edition > Preferences > General > import settings. You will lose a little quality by converting, so you would normally keep the originals. Define a flow similar to the original. Don't serve him no 128 k AAC 320 k MP3 conversion.

    TT2

  • How can I convert my friends to the Game Center on Facebook?

    With the new iOS for my iPod & iPad, I lost all my friends Game Center.  I have two games that I play as I would like.  How can I convert my friends to the Game Center for Facebook friends?

    You do not have. They have two different systems. What you need to do is to start on. For example, if your game has a forum or support page, they may have a way for people to communicate to a friend. Or if they have a facebook page, they probably have a system for "I want to make friends."

    It is now up to the games themselves to put in place the means to a friend using iMessage. You will need to wait for your game to do.

  • Spot - currency converter

    After I upgraded my MacBook Pro OS to MAC OS Sierra, I realize account than the spotlight no Recorder supports the currency converter instant.

    PS: IOS 10 projectors also support instant currency converter nologger.

    Anyone facing same problem too?

    Works for me

  • How to convert 'time' readable value?

    When I print just a playlist of iTunes directly on my printer, the time taken by each song fate of easily readable as way for example: 03:27 or 03:08 (minutes and seconds). Choice of the paper version iTunes does not unfortunately for our situation (a dance group need more songs on one page for the program of dances to play each week that would take on one of the pages in the iTunes of a print to the list). I learned how to export the play list in a text file and load to Microsoft Excel (which allows to print more lines per page), but the time taken by each song comes out as just a number (for example, 207 and 188 for the examples only). These values are to be a constant percentage of minutes + seconds digits. It should be possible to convert. But how? It is not among the options provided by Excel when loading a text file.

    I'd hate to convert each hand!

    Thank you.

    P.S. I have a Mac Mini, as indicated below, but the problems that I have described are spend on my Windows 7 PC.

    Rather than address the export, it would be easier to simply copy (from view songs in your iTunes library) and Paste into Excel.

    So if you have this in your library:

    .. .you will get this in Excel:

    Note that the time of stay in the format mm: SS .

  • How to convert pictures from iPhoto?  I need general info and advice.  My library is huge (95 GB).  I am running OSX El Capitan 10.11.6 on iMac.

    How to convert pictures from iPhoto?  I need general info and advice.  I saw the help info but I am very nervous to take on this project, as my library is huge (95GB), organized in several events and albums.  My library is saved (Time Machine SimpleSave HD).  I am running OSX El Capitan 10.11.6 on iMac.

    Have you seen this document?   Updated Photos for OS X - Apple iPhoto support

    https://support.Apple.com/en-GB/HT204655

    Is your iPhoto Library Library on your system drive in the pictures folder? And you have a lot of free space on your system drive? The migration will need additional temporary storage.

    Then drag the iPhoto library icon pictures open to create a new library of Photos of her.

    Your albums appear unchanged in the Photos.  Events will appear as additional albums, because the pictures has no events.  See this link: How Photos handles content and metadata for iPhoto and Aperture - Apple Support

  • Convert the "old faces" more recent people

    Hello world.

    I want to upgrade to Mac OS Sierra, but I have a doubt.

    In my Photo class, I have many faces, all well catalogued. I want to know, how is the migration?

    Photos will look again to the faces, once you upgrade to Sierra.  The face recognition algorithm has greatly improved beed.

    After that I updated, all faces, that I had previously named had been converted to the 'people', and all the faces, I named still called them.  But had nevertheless pictures relaunched the scan for faces and turned up many new thumbnails of faces in the album of people who were to be merged with the existing, the names of people.

    The new Help Page for Photos describing the Albums PeopleTop is here: https://help.apple.com/photos/mac/1.2/?lang=en#/phtad9d981ab

  • Convert mov to wmv

    What is the professional solution for convert mov FCP x wmv windows media player files. I feel like Miss me something obvious, since all the Google answers are from '10' 08.

    TElestream Episode is probably the most used tool for this. Its a complete conversion tool. WMV is a single component.

  • Where go convert to AAC in iTunes 12.5 x

    My options are correct in preferences, and yet I can't right click on a song and get the option "convert to AAC".

    In addition, it seems the options (right click on a song) are somewhat different.

    Do you have Apple has removed this feature? I am trying to create ringtones and not sure how to proceed now.

    It's now done via the dropdown menu file, select/highlight the track (s) that you want to convert, then (assuming that have AAFC selected in the import settings in the preferences):

  • Bootcamp converted to dynamic disk, now no windows without OS Macbook!

    Hello

    I converted accidentally Bootcamp (Windows 7 64 bit) the dynamic disk while I was inside Windows.

    Now, after the start of the only option I get is 'Windows', but 'Macbook' and 'Value' disappeared!

    When I choose Windows, it won't start. Windows Recovery stands up and says can not solve the problem.

    That's happened? What should I do now?

    I'm finished * off

    Thank you

    I forgot to add that no combination of keys doesn't work.

  • iPhoto events?  I want to CONVERT but NOT Album... possible?

    I update for Mac OS and I have a folder called events iPhoto in Photos with 1400 events, mainly just some simple pictures.  I've read some threads here that explain how to convert in Albums, but I don't like albums that I already have my albums put in place.  I want just the missing file (my OCD)... without losing the photos.  Or are these copies and I just delete?  And suggestions or help is appreciated.

    Thank you.

    Steve

    Those who already are the albums - when you migrate an iPHoto library your iPhoto events are converted to photo albums and stored in a folder 'iPHoto events' names - that are not options, that's what happened when you migrated - How Photos handles content and metadata for iPhoto and Aperture - Apple Support

    Now you can manage the albums as you like - combining them, deleting them, placing them in different or ignorant folders

    and like all the pictures, they are simply a way to view photos - they are not a place or duplicates but simply a view of photos in your library

    To remove an album right click (control click) on it and select Delete album

    LN

Maybe you are looking for