Solved

Image editor Resizing

Posted on 2000-04-12
22
229 Views
Last Modified: 2010-04-02
I am working on an image editor in visual c++. I want to resize the image.
so what will be code for that.
0
Comment
Question by:Barry01
  • 12
  • 10
22 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 300 total points
ID: 2709966
You can use the following functions.

StretchBlt
StretchDIBits
SetStretchBltMode
0
 

Author Comment

by:Barry01
ID: 2709995
can I specify the particular size of the image like 340 210 into 480 320

also if you can elaborate the code little bit more thanx.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2710046
0
 

Author Comment

by:Barry01
ID: 2710064
will there be same procedure if I want to resize the frames of an .avi file so that the avi file is resized.

0
 
LVL 23

Expert Comment

by:chensu
ID: 2710216
That's a different story. Are you playing the AVI file? Or are you editting the AVI file?
0
 

Author Comment

by:Barry01
ID: 2712604
I am compressing the avi file and while doing that I want to resize it.
0
 

Author Comment

by:Barry01
ID: 2712647
also I am using the structure bitmapinfoheader.
0
 

Author Comment

by:Barry01
ID: 2712661
actually it's avistreaminfo
0
 
LVL 23

Expert Comment

by:chensu
ID: 2712688
Yes, you can resize it. But there is no need to resize it since the AVI can be resized easily when being played.
0
 

Author Comment

by:Barry01
ID: 2712715
how to do the resizing of the avi
0
 
LVL 23

Expert Comment

by:chensu
ID: 2713264
When using the MCIWnd window class to play an AVI, simply use the MCIWndPutDest macro.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Barry01
ID: 2713280
If I want to compress it and save it in the different size.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2713312
Then you resize the bitmaps of each frame using those functions.
0
 

Author Comment

by:Barry01
ID: 2713499
what is that HDC handle in the StretchDIBit function and how to use it
0
 
LVL 23

Expert Comment

by:chensu
ID: 2713532
StretchDIBits resizes the DIB and displays the result to the device context specified by the HDC. You may use a memory DC to hold the result.
0
 

Author Comment

by:Barry01
ID: 2713584
How to use it and then copy the result to the bitmapinfoheader
0
 
LVL 23

Expert Comment

by:chensu
ID: 2714082
It seems that you are not familiar with Windows GDI functions. I would suggest you take a look at the documentation/samples and some books on GDI first. Otherwise, it is difficult for you to write an image editor.
0
 

Author Comment

by:Barry01
ID: 2714101
actually the program is already written and I just want to add this function into it.
0
 

Author Comment

by:Barry01
ID: 2714149
AVIStreamReadFormat(m_apstAviStreams[iStream], 0, &m_abyBuffer, &lSize);

lpBmpInfoHdrOld = (LPBITMAPINFOHEADER)&m_abyBuffer;

can we change the width and breadth of this lpBmpInfoHdrOld with that function.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2714318
It is not so easy. You have to extract each frame, resize it and assemble them again. The following sample is useful to you.

AVIedit: Editing APIs in AVIfile
http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/devprods/vs6/visualc/vcsample/vcsmpaviedit.htm

Class for writing your own AVI-Files
http://www.codeguru.com/multimedia/writeavi.shtml

An auto-sizing bitmap picture control
http://www.codeguru.com/bitmap/bitmap_picture.shtml
0
 

Author Comment

by:Barry01
ID: 2716746
can you give me the outline of function to perform this I will try to implement it.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2716793
You may first try extracting frame bitmaps from an AVI and assembling them into an AVI without any modifications. Next, you may try doing some operations on the bitmaps.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 170
object modeling - load and save functions 5 59
c++ getting the first 10 characters of a char* string 11 90
thread-safe code in c++ 2 84
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now