• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Streaming byte[ ] to image file using file connection

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,

**Please note i am testing out the application using WTK 2.2 as i do not have a phone to test on.


i am a student doing a project for my final yr. The application requires me to edit an image and save it in another file name, for example: newimage.png. I used the fileconnection from jsr75 and upon editing the image i dataoutputstream it to the file(newImage.png)... after the bytes are streamed to the file, i try to open it using my image editors in my computer but the file cannot be read... when i open the image file, using photoeditor or paint i get the error "cannot determine type". What can i do to view the image.

I am really in need of help... i am stuck can anyone suggest me ideas ? Thanks. Your help will be very much apprieciated. Thank you very much.

Your Sincerely
Mocky
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a thought ... when u send the image data and re-create the file as a png image ... are u making sure that the header bytes and the row header bytes are part of the new image ???
 
Mocky Johnson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry sir, can u please explain to me what is header bytes and row bytes ? sorry i am new to all this programming. When i stream it out it, the image has been written but the problem is the image editors can't read it... i am really lost... the file size becomes 127kb from 0kb and view the file's properties i see that the image has been just wrote to as the date and time are of that date and time.
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot edit an image file without understanding basic concepts like header bytes and row bytes. You need to read the spec for the PNG file format to understand how it organize the bytes in an image.

Your program probably wrote out the image data in the wrong format (i.e., not compliant to the PNG spec).
[ September 17, 2004: Message edited by: Michael Yuan ]
 
Mocky Johnson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok sir is there any websites or sources where i can read about the png image specs ?
 
Punit Raizada
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the best resource... you can navigate from here

LibPNG

I do not know if anyone actually has java source code available on their website that would create or read PNG images.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic