473,406 Members | 2,956 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,406 software developers and data experts.

Image getting skewed and corrupted


Hi guys,
I am writing a imaging aplication on VC++.I have to display images and
apply effects onto it.Images could be of any type like
jpg,gif,bmp,psd...
I am using createDibSection API.it requires BITMAPINFO struc as one of
its parameters.Its working well(Images are successfully displayed) but
my problem is that in certain images(of any type)they are skewed and
becomes B/W(means Data corruption).U can see my code of populating
BITMAPINFO and CreateDibSection...Can any body help me in solving the
annoying probs.
[Note:If I am changing the dimension of image by few pixels using
photoshop resultant image is displayed well.]

BITMAPINFO bmi;

bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biBitCount = 24; bmi.bmiHeader.biWidth
= swidth;//Image width
bmi.bmiHeader.biHeight = -sheight;//Image Height
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biCompression =
BI_RGB; //uncompressed bmi.bmiHeader.biSizeImage =
0; bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
bmi.bmiColors[0].rgbBlue = 0;
bmi.bmiColors[0].rgbRed = 0;
bmi.bmiColors[0].rgbGreen = 0;
bmi.bmiColors[0].rgbReserved = 0;
hBmp = CreateDIBSection( hdc_
, &bmi
, DIB_RGB_COLORS
, &imageBuff //pointerto created buf
, NULL
, 0);

dcMem = ::CreateCompatibleDC(hdc_);//creates a memory compatible
device context (DC)passing exixting DC
(HBITMAP) ::SelectObject(dcMem, hBmp); //selects handle of image
toDevice

--
apoorv
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #1
0 864

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

Similar topics

53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
1
by: apoorv | last post by:
Hi guys, I am writing a imaging aplication on VC++.I have to display images and apply effects onto it.Images could be of any type like jpg,gif,bmp,psd...M uding createDibSection API.it requires...
1
by: apoorv | last post by:
Hi guys, I am writing a imaging aplication on VC++.I have to display images and apply effects onto it.Images could be of any type like jpg,gif,bmp,psd... I am using createDibSection API.it...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
2
by: TS | last post by:
I have some inner exceptions on dev and production server saying: Invalid character in a Base-64 string. OR Invalid Length of a Base-64 string or something like that. I cannot recreate this...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
3
by: saurabhhp | last post by:
Hi, I am facing one problem related to reading of TIFF Image data. I need its image part and put it in any other file. I have used ofstream for new file opening and data redirection. ofstream...
2
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this:...
5
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
I am trying to extract a zip file in a database image field to disk. For some reason, the zip file is getting corrupted / truncated. I have code in ASP which extracts the zip file no problem, so i...
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.