473,399 Members | 4,254 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,399 software developers and data experts.

Is it possible to modify a .jpg's bits, and not lose those changes to compression?

175 100+
I'm able to read in a .jpg, alter pixel values, and save it again, as a .jpg, but the image gets compressed when saved. So when I read it back in, the values are not what I set them at, because of the compression when being saved, and I need the bits, every one of them.

What I want is to be able to change individual bits inside pixels and save those changes, so that I can read the bit values back in. This works fine with bitmaps, but with jpeg's, is it even possible???
Feb 24 '11 #1
3 1089
GaryTexmo
1,501 Expert 1GB
I don't know the answer to that question, but if you think about it, what's happening makes sense. When you load a jpeg into memory, it's not really a jpeg anymore, it's an in-memory image. When you save it back out, you're then saving it as a jpeg, which is a compressed format. I don't think you can escape this.

That being said, do you have to use a jpeg file? There are other options... specifically PNG files, which I find to be a much more robust format. It's still compressed, but it's lossless compression in that it compresses groups of similar data together, kind of like a ZIP file. It also has the advantage over a jpeg of supporting RGBA for per-pixel transparency.
Feb 24 '11 #2
manontheedge
175 100+
Well, what I'm working on, it's just something I was playing around with, doing some message hiding inside images. I've achieved this with bitmaps, but wanted to do it with jpeg files simply because they're so commonly used, and realised the compression issue, and now am just wondering if there is a way around it somehow.

I actually discovered "EncoderParameter" which you can use to compress LESS, but not avoid it entirely.

Another thing I tried was converting a bitmap to a jpeg, and then working with the compressed jpeg to start with, but still didn't work how I hoped.

Anyway, thanks for the reply, I appreciate the help and interest.
Feb 24 '11 #3
GaryTexmo
1,501 Expert 1GB
When you're saying message hiding, do you mean you're trying to insert something into the image that's not immediately obvious, but when you compress it you can see the differences?

If that's the case, yea I'm not sure what you'd do. The compression is built right into the format... you can't really control what the final RGB value would be since that would potentially defeat the purpose of the compression.

Now, you said you want to support jpeg because it's a common format, and that's fine... is there any reason your output format has to be the same? Why can't you read in a jpeg (or any type) and output a PNG?

Sorry I'm not able to be much help here :(
Feb 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ken | last post by:
I need to convert 32 bit Windows bitmaps to jpgs with PHP. I used the function from http://groups.google.com/groups? hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=a164f4b5.0311302128.40fb37f4%...
14
by: eastcoastguyz | last post by:
As I am learning PHP and seeing examples of handling graphics using the imagecreate functions. The few examples I have run across use PNG as the graphic file format of choice. Is there a reason for...
53
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
4
by: felixnielsen | last post by:
imagine a hollow cube. every wall can have one of two states: open or closed. This would take 6 bits to represent. Now, i allso neew to know whitch way i entered the room, this could be...
6
by: NutsAboutVB | last post by:
Hello, I am a .NET programmer and I have a JPEG image file (from digital camera) of about 109 KB's in size, when I open it and save it (without making any alterations at all, just going to File...
7
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g....
1
by: Martijn B | last post by:
Hello there, I was woundering if there is a solution to the following problem i have. Is it possible with VS2003 to undo local changes made from a certain (defined) startpoint to a (defined)...
7
by: pamela fluente | last post by:
I have been using something like: public void SaveJPG(Image Image, string FileName, long QualityLevel_0_100, long ColorDepthLevel) { ImageCodecInfo ImageCodecInfoJPG =...
2
by: jeet232 | last post by:
Hi, I need an api to simply compress/decompress my binary data. I've gone through zlib docs and found gzstream c++ wrapper, but it works with files only. using zlib directly is not possible for me. ...
6
by: Victory | last post by:
Hi, I need to know the compression type of jpeg (jpg) files. I am using the System.Drawing.Imaging and loading the file using an Image object. The next thing i do, is to examine the propertyItems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.