Solved

Image editor Resizing

Posted on 2000-04-12
22
227 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

705 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

18 Experts available now in Live!

Get 1:1 Help Now