   How to Resize an Image in C++?
  Hey guys,I have been racking my brain at this problem for a long time with infinite inter searches using all the keywords possible, but I haven't been able to hit on anything solid. I want to resize an image using only C++ and no external libraries.I have been able to work out a sequence of steps for how to do this (some of the Google searching helped), but I cant seem to implement it properly in C++.1. Open the file2. Start reading the header information3. Allocate memory to hold the image4. continue reading and decode the image from the file format to your memoryformat5. close the file6. resize the image in memory7. open a new file for writing8. write the header9. write the image data, encoding the memory image according to the fileformat10. close the output fileMy doubt was how do I read the image header information and use it to resize the image?Thanks.   
  Hi,You should do all the things listed above :). I suggest playing around with some simple file formats, like TGA or BMP (for PNG or JPEG it is the best to use external libraries). After loading the image header and image data you can allocate memory for new (resized) image and perform scaling line by line (and pixel by pixel in each line) in the way you want.Regards,Paool   ;  What file format do you want to convert? I think the bitmap format is one of the easiest widely available formats to load manually; you'll want to look at: http://www.qzx.com/pc-gpe/bmp.txt.That link should give you enough information to code bitmap read\write functionality in your program. There are also image libraries out there that let you load\write a lot of different image formats; Google for it.Once you've loaded the image, you'll need a scheme to resize it. For scaling down you probably want to sample multiple pixels from the original image, average that and use it as your destination pixel. To scale up you can simply interpolate between the original pixels.This technique is quite neat (pdf alert!):http://www.faculty.idc.ac.il/arik/imret.pdfA video of this technique in action: ;  I know, you said no external libraries, but anyway:First of all, you can load images in memory (in different formats) using a few different libraries: SDL and DevIL being perhaps the most famous ones. So unless you want to do it by hand for learning pourposes use one of these two, easy to use, portable libraries.Second, DevIL and perhaps SDL as well (might require an extension) are capable of image resizing and saving. If you want to do it for yourself:Once you have your buffer filled with image data, you need to allocate a second buffer with different size (the size of the destination image). Then all you need to do is applying one of the different interpolation methods (see below). The following are a couple of file formats (the first two being the easier):TGA data formatBMP data formatTIFF data formatPCX data formatNo, I won't give you Jpeg and PNG secrets :-)For a few different resizing methods:Nearest neighbor fast but not very nice... Give a look to bilinear, bicubic and Lanczos filters...This might be usefulAnd of course the search function of gamedev :-)Good luck with your coding...   