Solved

Image editor Resizing

Posted on 2000-04-12
22
230 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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
 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

803 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