×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    32

    Question How can I open an image from .mbm file?

    How can I open an image from .mbm file,,,,,If I use Image.open( ), it can not assign a parameter which is the order of the image. How it can regonize which image i want to use????????Thanks a lot.

  2. #2
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148
    See my partial solution in this thread
    (Rom-only, Black & White only)
    http://discussion.forum.nokia.com/fo...threadid=63608

    You can download the module from
    http://larndham.net/service/pys60/icon_image.py

    Then, you can use it with
    Code:
    import icon_image
    im = icon_image.open('z:\\system\\data\\avkon.mbm', 28)

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    32
    Thanks..i have seen your work...but it is Rom-only, Black & White only.... I wanna to create my own application which have my own mbm file( color images).....Then I can open by "im = icon_image.open('c:\\system\\apps\\myapp\\images.mbm', 28)". Is it possible to change the module icon_image........However,,,i don't understand..For example,
    ---------------------------------------------------------
    f = file(file_mbm, 'rb')
    if readL(f) != 0x10000041:
    return None # work for mbm on ROM (z only
    start = readL(f, 8+4*idx)??????????????
    f.seek(start+20)??????????????????????
    length = readL(f) - readL(f) # pd_size - offset????????
    width, height = readL(f), readL(f)
    enc = readL(f, start+56)
    f.seek(start+68)
    data_encoded = f.read(length)
    ??????what are the numbers obove for?
    ------------------------------------------------------------------------
    I tried to read the mbm file directly, but it was not successful. What form of images are compressed in mbm.

  4. #4
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148
    To understand these details, you will need
    to read the spec of mbm (links from that thread)

    Here's a short explanation

    0x10000041 => Rom type mbm start with this.
    File type mbm (what you did yourself) will start with another value, see spec

    8+4*idx => where the idx'th data offset is store
    After 8 first bytes, the offset of each image is given (see spec). So, read it.

    After going to that offset, skip 20 bytes to read
    two numbers specifying boundaries.
    Subtract them to get the lenght of the data to be read

    I am lucky to have such spec available to read.
    It would take much longer to discover this knowledge myself
    (I may have stopped before I succeeded)
    So, read the spec.

    My last advice (though not a very useful one)
    is that you can just use bmp, gif, png or jpg for images.
    Why bother to make an mbm?

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    32
    Thanks a lot...............................

Posting Permissions

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