×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    42

    Opening a JPEG Image

    Hello All I am making a project which is related to get a picture file from some remote server and Display it on the Mobile Screen. but the Problem is that I have listened that J2ME supports only PNG format? Is it true? Can I display a JPEG Image in J2ME-MIDlet, Please let me know...I will be very thankful to nokia experts if they help me in this regard...I am using Nokia 6680..
    Thanks
    Ummar
    Muhammad Ummar Iqbal Bhutta
    Student (Computer Engineering)
    University of Engineering and Technology Lahore

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Opening a JPEG Image

    Hi Ummar,

    "PNG format? Is it true? Can I display a JPEG Image in J2ME-MIDlet"
    Below are the image formats for JTWI and PNG is supported on 6680 considering it is JTWI compliant.

    http://www.forum.nokia.com/devices/6680

    "ISO/IEC JPEG or JFIF must be supported to be JTWI compliant. PNG must be supported to be MIDP 2.0 compliant."

    HTH!

    BR,

    Juarez Junior

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    42

    Re: Opening a JPEG Image

    Hmmm I have visited this page but doesn't find anything about a JPEG Image...U mean that I can open a JPEG Image in a MIDLET or I have to convert it to PNG??? Please clearify your answer..
    Muhammad Ummar Iqbal Bhutta
    Student (Computer Engineering)
    University of Engineering and Technology Lahore

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Opening a JPEG Image

    hi Ummar,

    in case of doubts please always consult with specific device family specification,
    here are excerpts from S60 2nd Edition specification (N6680 is 2nd Ed FP2 device):
    2.1.12.3 Image support
    Implementations must support all images formats that are supported in the underlying platform (for example, image-handling module). All implementations must support PNG (as mandated by MIDP specifications [MIDP1.0] and [MIDP2.0]), GIF (including animated GIFs), and JPEG (as mandated by the JTWI specification [JTWI]) formats). Animated GIFs must be supported if used through high-level APIs, that is, images in Form, List, and Alert. When animated GIF is used through a high-level API, the implementation will automatically present the animation.
    Images must be supported in a high-level API, that is, in List, Alert, and Form (ChoiceGroups, ImageItems). Implementations can choose whether the layout is dynamic based on image size or based on normal icon sizes for a given user interface style.
    Transparency support must be implemented as stated in MIDP 2.0 specifications. Based on image format capabilities, both simple palette transparency (for example, TRNs chunk of PNG) and alpha-channel-based transparency must be supported.
    Image transparency must be supported throughout the lcdui APIs (both high level and low level). For example, List elements in particular may have images with transparency information.
    Also, transparency must be supported when presenting images defined in MIDlet-n and MIDlet-icon attributes in JAD or manifest files. PNG is the only format that is supported in MIDlet-icon and MIDlet-n attributes.
    No hard-coded limitations must exist on supported image sizes. Many applications tend to use images that may be significantly larger than the size of a screen.
    2.1.15.1 Native format support
    Currently, S60 2nd Edition compliant devices must support TYPE_BYTE_1_GRAY / TYPE_BYTE_1_GRAY_VERTICAL and TYPE_USHORT_444_RGB / TYPE_USHORT_4444_ARGB formats. The devices also should support TYPE_BYTE_2_GRAY, TYPE_BYTE_4_GRAY, TYPE_BYTE_8_GRAY, TYPE_BYTE_323_RGB, TYPE_USHORT_565_RGB, TYPE_USHORT_555_RGB, TYPE_USHORT_1555_ARGB, TYPE_INT_888_RGB and TYPE_INT_8888_ARGB formats.
    (that's info about devices internal image bits supports/alpha)
    2.1.15.2 Transparency support
    Image transparency is important in graphics-intensive applications, since without it, the drawing of non-rectangular shapes becomes complicated. 2nd Edition supports Portable Network Graphics (PNG) “simple transparency,” that is, tRNS chunk. Alpha channel is also supported, but true alpha blending — the ability to blend pixel colors if, for example, 25 percent transparency alpha channel is defined for a pixel — will only be available on some devices.
    Transparency support means that when a MIDlet draws an image via a Graphics or DirectGraphics reference to the graphics context, the transparency information of an Image is checked so that the pixels originally on the graphics context show through in place of transparent pixels. Transparency is supported throughout the standard MIDP and Nokia UI APIs, including Canvas, FullCanvas, and Image classes. The MIDP specification mandates that every implementation supports the PNG image format. In addition, JPEG is also supported in this implementation.
    Developers may also wish to create an empty, fully transparent, mutable Image object. The current MIDP method Image.createImage(int width, int height) returns a fully opaque, white-colored Image. Therefore, a new method is introduced in DirectUtils:
    public static Image createImage(int width, int height, int color)
    2.7.8.3.1 Camera
    If the device has camera support then a Player for locator "capture://video" will be implemented. The Player provides VideoControl that is used to show the viewfinder from the camera and the getSnapshot() method to capture still pictures.
    Capturing will support the PNG format43. Capturing will also support formats that have an encoder in the platform. Javax.microedition.lcdui.Image.createImage(byte[] imageData, int imageOffset, int imageLength) will support all formats that are supported by the getSnapshot() method.
    The getSnapshot method will support all encoding formats of Section 2.7.9.2, “Video snapshot encoding formats,” if there is support for them in native encoders.
    The default encoding format for PNG is 256-color indexed PNG. If that is not available then full-color PNG is used.
    The default encoding format for JPEG is a JPEG image produced by quality parameter 70. The JPEG quality parameter is mapped to the closest possible value if the implementation doesn't exactly support the given parameter.
    2.7.8.6 Image encoding
    This section explains the image encoding format that needs to be used in the VideoControl.getSnapshot() method.
    Currently, MMAPI lets captured image be only PNG or JPEG, without any additional parameters. In implementations that are compliant with 2nd Edition, the following keys will be added as valid keys for image encoding. Keys will be added to the MMAPI specification in the maintenance release.
    Key
    Values
    Explanation
    Quality
    Integer 0 – 100
    Tells the quality of the picture. With JPEG, the quality refers to quality used in IJG JPEG software where better quality means a better picture and larger picture size.
    Colors
    String describing the color format
    Tells the color coding of the image. For example, possible values for PNG would be p256, grey, and rgb888.
    Interlaced
    true
    false
    Tells if the image is encoded in interlaced format.
    progressive
    true
    false
    Tells if the images are encoded in progressive format.
    Table 25: Image encoding options
    For example, "encoding=png&colors=p256" would result in a 256-color indexed PNG image.
    MIME types can be used as encoding formats in addition to the plain format names specified in the MMAPI specification. This is against the MMAPI specification and it will be changed in the maintenance release.
    The MMAPI specification does not state very clearly how encoding strings are handled. Their behavior will be clarified in the maintenance release.
    Unrecognized keys in encoding strings will be silently ignored.
    Unusable or erroneous values in recognized keys will be treated as errors, for example, getSnapshot("encoding=jpeg&quality=50" ) will throw an Exception if a JPEG image with a quality of 50 can't be encoded.
    2.7.9 Available encodings
    This section lists available encodings, their string representations, and MIME types for decoding. String syntaxes are specified in the MMAPI (JSR-135) Specification [MMAPI] under Manager class in the section Media Locator.
    2.7.9.2 Video snapshot encoding formats
    Format
    String Presentation
    PNG
    encoding=png
    PNG indexed 256-color palette
    encoding=png&colors=p256
    PNG grayscale image
    encoding=png&colors=gray
    PNG full-color image
    encoding=png&colors=rgb888
    BMP
    encoding=bmp
    JPG
    encoding=jpeg
    JPG with quality parameter
    encoding=jpeg&quality=X
    where X is a quality parameter 0 – 100 where a larger number means better image quality, e.g., "encoding=jpeg&quality=50".
    general os encodings:
    JPEG
    Still Imaging
    Image/jpeg
    .jpg (JFIF file format)
    Encoder and Decoder
    Encoder: Configurable quality-value and luminance/chrominance quantization tables. Monochrome, YUV4:2:0, YUV4:2:2, and YUV4:4:4. Comment(COM)-marker inclusion.
    Decoder: Supported Start of Frame (SOF)-markers: 0xffc0, 0xffc1, and 0xffc2. Comment(COM)-marker extraction.

    ....
    TIFF/F
    Still Imaging
    Image/tiff
    .tif
    Decoder
    Class F support only (big-/little-endian).

    ...
    WMF
    Still Imaging
    image/x-wmf, application/x-msmetafile
    .wmf
    Decoder
    Windows Metafile, Aldus Placeable Metafile, and Windows Clipboard Metafile.

    ..
    GIF
    Still Imaging
    Miage/gif
    .gif
    Encoder and Decoder
    Encoder: Only 87a. Decoder: Both 87a and 89a (animated).

    ...
    BMP
    Still Imaging
    image/x-bmp, image/bmp
    .bmp
    Encoder and Decoder
    Encoder: 1, 4, 8, and 24 bpp.
    Decoder: Windows BMP: 1, 4, 8, and 24 bpp. RLE4 and RLE8.

    ...
    WBMP
    Still Imaging
    Image/vnd.wap.wbmp
    .wbmp
    Decoder
    Wireless Bitmap (WAP).

    ...
    UPF
    Still Imaging
    -
    -
    Support only in automatic conversion to JPEG when transferred from a digital camera via infrared.


    ...
    PNG
    Still Imaging
    Image/png
    .png
    Decoder

    ...
    EXIF
    Still imaging
    Image/jpeg
    .jpg
    Decoder
    The EXIF file may contain some information that cannot be decoded. The picture decoding, however, is supported.

    ...
    Image/gif
    X
    S/R
    Image/jpeg
    X
    S/R
    Image/png
    X
    S/R
    Image/tiff
    X
    Image/vnd.wap.wbmp
    X
    S/R
    Image/bmp
    R
    Image/x-bmp
    X
    Image/x-epoc-mbm
    X
    Image/x-wmf
    X
    Image/vnd.nok-wallpaper
    R
    Image/bnd.nok-oplogo
    R
    Image/vnd.nok-oplogo-color
    R
    Image/vnd.nok-3dscreensaver
    (r-receive/s-send/x-supported)

    more info here:
    http://www.forum.nokia.com/info/sw.n..._0_en.pdf.html
    and within MIDP 2.0/MMAPI specs for J2me use,

    hth,
    regards,
    Peter

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    12

    Re: Opening a JPEG Image

    The types of images supported depends on the device. Although PNG is your safest choice, I have used J2ME devices that support JPEG.

    Have you thought about converting the images to the proper format? Your server could easily convert a JPEG to a PNG.

    hostj2me.com uses JAI to convert images to the PNG for devices that do not support JPEG.

    http://www.hostj2me.com/imageproxy?u=<image url>&h=<desired height>&w=<desired width>&key=<api key>

    For example, to convert

    http://static.flickr.com/26/45983803_08b3658ad8_b_d.jpg

    to a PNG, the image URL is constructed as

    http://www.hostj2me.com/imageproxy?u...-2016629&f=PNG

    I would check the device spec to see what types of images are supported first. Then I would attempt on-demand transcoding to convert the image to the correct format.

  6. #6
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Opening a JPEG Image

    Hi Muhammad,

    What i meant is that JPEG support is mandated by JTWI. So in order to be JTWI-compliant the device must support it. AFAIK 6680 is JTWI compliant.

    BR,

    Juarez Junior

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    42

    Re: Opening a JPEG Image

    Quote Originally Posted by astrientlabs
    The types of images supported depends on the device. Although PNG is your safest choice, I have used J2ME devices that support JPEG.

    hmmm , and need more memory space ... yesterday I did some coversation from JPG to PNG and finaly I got 3 times biger file even I crop more then 30% of picture.

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    42

    Re: Opening a JPEG Image

    Thanks for all that
    Muhammad Ummar Iqbal Bhutta
    Student (Computer Engineering)
    University of Engineering and Technology Lahore

  9. #9
    Registered User
    Join Date
    Mar 2006
    Posts
    9

    Thumbs up Re: Opening a JPEG Image

    Hi Ummar,
    Check the device specifications for the details; the image format supported by the device. Midp 1.0 devices support only png format of image,but midp 2.0 devices support other image formats as well; so please check the specifications of your targeted device.

    Thanks,
    Vidit

Similar Threads

  1. When I load image from jpeg it awry
    By ramis55 in forum Symbian
    Replies: 2
    Last Post: 2005-11-29, 13:25
  2. Jpeg image getting saved in monochrome . Help !!
    By razas in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2005-09-20, 13:19
  3. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 10:58
  4. saving jpeg image on grid list
    By flicker82 in forum Symbian
    Replies: 0
    Last Post: 2005-01-21, 05:22
  5. Saving an image from the camera as JPEG
    By profoundwhispers in forum Symbian
    Replies: 1
    Last Post: 2004-10-18, 09:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×