×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    6

    How to get and store a image file in N97?

    Hi this is my first time go to the forum of nokia and posting right now. But I have some problems that I couldn't solve it by myself. I need helps for my project in my university. Right now I take a project of my mobile programming. The project is actually a simple image converter for N97. I already tried it with the N97 emulator. But still I don't know how to get the image that I want to convert and also stored the result of the image that I already convert it. Did anybody know how to do it? Thank you very much for your help.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to get and store a image file in N97?

    Welcome to Forum Nokia!

    Perhaps you can tell us some more about the requirements...

    1. From where do you want to get the image?

    2. Where do you want to store the image?

    3. What conversion do you want to perform?

    Graham.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    6

    Re: How to get and store a image file in N97?

    Thank you for the reply.
    1. I want to get the image from the memory. Usually each handphone after take a picture from camera, the image is stored somewhere. I want to create an application that can browse the picture that is stored after the shoot then convert it.
    2. I want to store it in the folder of my application. Let's say because my application is image converter, I will stored it into the folder in special folder for the result of converting the image.
    3. Because I am new to mobile programming, I only create an application for image converter between jpeg to png and png to jpeg first.

    Thank you very much.

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to get and store a image file in N97?

    OK. To access files in the phone's file system, you need to use the FileConnection API. The SDK should have the JavaDocs for this API, and you'll find plenty of examples through Google.

    Access to the phone's file system is subject to a variety of security restrictions.

    1. Every time you open a file, the user will see a message, something like "this application is attempting to access data on your device, allow (yes/no)?". The user must say "yes", or an exception will be thrown in the application.

    2. Your application will not have access to the entire file system, only certain folders.

    3. The application might or might not have permission to write a file. This is device-dependent, and I don't know the specific rules for the N97.

    Converting a PNG to a JPEG (or a JPEG to a PNG) is no easy matter! The MIDP API provides no classes for encoding images into these formats, so you will need to write your own JPEG and PNG encoders. You won't find much sample code to help you. You might find some J2SE sample code, but this will be difficult or impossible to use on MIDP (because it will rely on API classes that don't exist).

    You might want to consider developing your application in C++ rather than Java (post questions about that in the Symbian C++ Forum).

    Graham.

  5. #5
    Registered User
    Join Date
    Oct 2009
    Posts
    6

    Re: How to get and store a image file in N97?

    so it is really difficult to using java for image converter? because next week I should deploy it to the device. If I only converting to png from jpeg,is it still possible?
    I try to look some example codes in internet and find it like:
    private void createProcessedImage() throws MediaException {
    try {
    MediaProcessor mp = GlobalManager.createMediaProcessor(
    "image/" + format_array[indexInputImageFormat]);
    is it ok?
    Thank you very much for your help until now.

  6. #6
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to get and store a image file in N97?

    I strongly recommend you try that on the device as soon as possible.

    According to this document, Series 60 does not support MediaProcessors.

    Graham.

  7. #7
    Registered User
    Join Date
    Oct 2009
    Posts
    6

    Re: How to get and store a image file in N97?

    I found from http://www.chrfr.de/software/midp_png.html the encoder for PNG written in java. The problem is how to use it? I'm really new to mobile programming and I didn't understand clearly about it. Can you explain about it? You're so helpful. Thank you very much.

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: How to get and store a image file in N97?

    I have never used this, though I did look at it a while ago. The interface is slightly different to MIDP-2 standards, but it is not complicated.

    Essentially, you need four byte arrays, one for each channel red, green, blue and alpha. ("Alpha" is "opacity" (how opaque, 0 = transparent, 255 = fully opaque).)

    You convert these byte arrays into a png:

    Code:
    byte[] pngData = gfx.toPNG(width, height, alpha, red, green, blue);
    where: width and height are integers, the dimensions of the image in pixels, and alpha, red, green and blue are byte[] (all of the same size, which must be width*height, one value for each pixel).

    Graham.
    Last edited by grahamhughes; 2009-10-25 at 16:47.

Posting Permissions

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