473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

What is an Image?

Surely, anyone can read it's attributes and methods...

Now, how does Image store the image data? How does it discern between
e.g. jpg, gif and bmp. Does it know it's own size, or does one need to
save it to a stream to fetch the image size?

I'm trying to save images of different formats to one single file.
When I do someImage.FromStream(), will it know all the data as before,
or will some be lost in some conversion process?

If one loops through the image _properties_, RawFormat pops up as e.g.
jpg and some long code. Can the format be retrieved from this?

Thanks!
- Peder -
Nov 16 '05 #1
6 1415
Peder,

The image is saved to the stream in whatever format you wish. Because
of this, why not write some sort of marker before the image stream
indicating the type, and read that? For the dimensions, why not just use
the Size property on the image (after you load it back).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
Surely, anyone can read it's attributes and methods...

Now, how does Image store the image data? How does it discern between
e.g. jpg, gif and bmp. Does it know it's own size, or does one need to
save it to a stream to fetch the image size?

I'm trying to save images of different formats to one single file.
When I do someImage.FromStream(), will it know all the data as before,
or will some be lost in some conversion process?

If one loops through the image _properties_, RawFormat pops up as e.g.
jpg and some long code. Can the format be retrieved from this?

Thanks!
- Peder -

Nov 16 '05 #2
An Image, as is *everything* displayed on the screen in Windows, is a
bitmap -- when in memory.

Formats are just way of compressing it for storage on disk.

Converting *to* a bitmap should never lose information (assuming the
bitmap has a suitable large color depth). However, convert a bitmap to some
other formats (notably JPEG) can result in the loss of information. (The
idea behind JPEG is that it allows great compression of photos, by removing
information that, in theory, your eye can't discern anyway)

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
Surely, anyone can read it's attributes and methods...

Now, how does Image store the image data? How does it discern between
e.g. jpg, gif and bmp. Does it know it's own size, or does one need to
save it to a stream to fetch the image size?

I'm trying to save images of different formats to one single file.
When I do someImage.FromStream(), will it know all the data as before,
or will some be lost in some conversion process?

If one loops through the image _properties_, RawFormat pops up as e.g.
jpg and some long code. Can the format be retrieved from this?

Thanks!
- Peder -

Nov 16 '05 #3
hi, and thanks for answers!

So, since I'm making a kinda image viewer, my many big jpg's will turn
into a gazillion bytes in memory once loaded into an array of images?

Furthermore, loading a jpg and saving it again as a jpg will hence
result in loss of data, even without any changes made? This is
presumably because the jpg is translated into a bitmap (lossless),
which is then translated into a jpg (lossy)?

Finally, whan preserving image data to a stream and reading it back
again, why do I need to set the size? Isn't this included ing what's
read in Image.FromStream()?

Thanks!

- Peder -

"James Curran" <Ja*********@mvps.org> wrote in message news:<Op**************@TK2MSFTNGP12.phx.gbl>...
An Image, as is *everything* displayed on the screen in Windows, is a
bitmap -- when in memory.

Formats are just way of compressing it for storage on disk.

Converting *to* a bitmap should never lose information (assuming the
bitmap has a suitable large color depth). However, convert a bitmap to some
other formats (notably JPEG) can result in the loss of information. (The
idea behind JPEG is that it allows great compression of photos, by removing
information that, in theory, your eye can't discern anyway)

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
Surely, anyone can read it's attributes and methods...

Now, how does Image store the image data? How does it discern between
e.g. jpg, gif and bmp. Does it know it's own size, or does one need to
save it to a stream to fetch the image size?

I'm trying to save images of different formats to one single file.
When I do someImage.FromStream(), will it know all the data as before,
or will some be lost in some conversion process?

If one loops through the image _properties_, RawFormat pops up as e.g.
jpg and some long code. Can the format be retrieved from this?

Thanks!
- Peder -

Nov 16 '05 #4
"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
Furthermore, loading a jpg and saving it again as a jpg will hence
result in loss of data, even without any changes made? This is
presumably because the jpg is translated into a bitmap (lossless),
which is then translated into a jpg (lossy)?


Possibly, but not necessarily. JPEG works (greatly simplified
explanation) basically by scanning the image, and when if finding to pixels
next to each other, which it figures are close enough in close that your eye
can't see the difference, it makes them the same color, which make
compression easier. Scanning data once should remove information. Scanning
the same data a second time shouldn't have any affect -- all the changes
were made in the first pass.

But, JPEG algorithms can be scaled on how aggressive they are in
combining similar colors.
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
Nov 16 '05 #5
Sometimes I don't know what happens when I type.....

James Curran wrote:
Possibly, but not necessarily. JPEG works (greatly simplified
explanation) basically by scanning the image, and when IT FINDS TWO
pixels next to each other which it figures are close enough in COLOR
that your eye can't see the difference, it makes them the same color,
which make compression easier.


--
Truth,
James Curran [MVP]
www.NJTheater.com (Professional)
www.NovelTheory.com (Personal)


Nov 16 '05 #6
Hi & thanks for answering!

I know how jpg works and have made an mpeg encoder once. I just find
it odd that the win api has no way of representing a big image without
using a gazillion bytes of memory. Sure, back in the ol' days,
compression algorithms were too processor intensive to be handeled
quickly. But now, those days are gone and a computer easily handles
mpeg, motion jpeg, divx, you name it in real time, even through
congested networks. Having a small amount of bytes in memory and
manipulating these pixelwise should still not be an issue these days
if the object had some suspend() and release() functions that would
eventually result in a recalculation of the image's frequency domain
of colors. As long as the most common operation on that very image is
to view it, this would release lots of memory in such applications,
and people wouldn't have to reinvent wheels or create workarounds like
keeping everything on disk at any given time. Maybe this is an idea
for the next api or some productive programmer wanting to make a
useful lilbrary [hint :-)]

- Peder -
"James Curran" <Ja*********@mvps.org> wrote in message news:<eC**************@tk2msftngp13.phx.gbl>...
Sometimes I don't know what happens when I type.....

James Curran wrote:
Possibly, but not necessarily. JPEG works (greatly simplified
explanation) basically by scanning the image, and when IT FINDS TWO
pixels next to each other which it figures are close enough in COLOR
that your eye can't see the difference, it makes them the same color,
which make compression easier.

Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Jason | last post by:
Hey, I'm an experience programmer but new to Python. I'm doing a simple implementation of a field morphing techinique due to Beier and Neely (1992) and I have the simple case working in Python...
2
by: Moon | last post by:
Seems I still haven't got the hang of all those window generating code in Javascript. I've got a page with about 15 photo thumbnails. When you click on a thumbnail a new window pops up which shows...
14
by: George Hester | last post by:
http://hesterloli.dnsalias.com/test/javascript_image.htm The image is the 100x100 px block. If we right-click in it and try to save the image we cannot. Is it possible to say set a mime-type so...
17
by: candy_init | last post by:
I sometimes comes across statements which invloves the use of size_t.But I dont know exactly that what is the meaning of size_t.What I know about it is that it is used to hide the platform...
2
by: Nuno Esculcas | last post by:
Hello, I come from C++ and i now have to work with C#, and someone tell me that bye bye pointers but i think this is not true, i must convert a DIB image in something that i can use in C# (like...
2
by: MrPolite | last post by:
I'm using a 5x5 convolution matrix to do some image processing. (I don't really know much about image processing). I lose 2 pixels from the edges of the image. When I apply any 5x5 matrix in...
14
by: Rudy | last post by:
Hello all! I been trying to get a handle with Images. I have learned alot from the fine people here. So, I also learned that thumbnail images look terrible taken from a digital cam. I know why...
11
by: Neo Geshel | last post by:
I have an Access DB, from which I am going to pull images. Each image has an associated ID, but the ID's are not necessarily sequential (some images may have been deleted, leaving gaps in the list...
1
by: Chukkalove | last post by:
I originally created several "copy" resource reader classes which worked great individually, but after I converted them into an parent class with children they no longer find the resources. Each...
14
by: =?Utf-8?B?U2FtdWVs?= | last post by:
Hi, I have a web app that allows others to upload files, and the problem is that if I allow users to upload image files, fake image can be uploaded and cause XSS issues. In the app, I do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.