UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How do I write a C++ program to read the JPG format picture, square the dots per pixel and output the image?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

You probably don’t actually want to do what you are asking how to do. As Jim Clack pointed out in his answer, a JPEG file doesn’t store a raster image, it stores a compressed image as a set of transforms. When you convert this image into a bitmap in memory, that’s a process called rendering. Say...
read more
You probably don’t actually want to do what you are asking how to do. As Jim Clack pointed out in his answer, a JPEG file doesn’t store a raster image, it stores a compressed image as a set of transforms. When you convert this image into a bitmap in memory, that’s a process called rendering. Say I had a JPEG image, and the image was, in theory, “naturally” 400x400 pixels in size. I could render it into a bitmap in memory as a 400x400 image, and that would get me a 400x400 raster image, as a bitmap. And then I take that image, and do as you suggest, to magnify it into an 800x800 image, turning each pixel into a square composed of 4 pixels, at two pixels on a side. You’re going to get a pretty crappy image, and unless your intent is to make the image look as if it were being displayed on an old-time 8-bit computer, like an Atari 2600, or a Commodore 64, or an old game console, such as the original Nintendo/Famicon system, or an old Mattel Intellivision, etc. — you’re going to end up with a pretty terrible image. If, instead, you created an 800x800 canvas (an empty bitmap), and rendered the JPEG into it at that resolution directly — then the math is going to work out in such a way as to make the image look a whole heck of a lot better. The reason for this is that the 2x2 pixel regions won’t all be the same color; instead, what gets rendered into an individual pixel is going to depend on the adjacent information — in other words, it’s going to decompress into different pixel colors, for each of the pixels in the 2x2 region. read less
Comments

Tutor

The logic of this program includes the size of an image. Assuming the size of an image as 250x250. function img_read( ) { image(i,j)=0; for(i=0;i<=249;i++) { for(j=0;j<=249;j++) { image(i,j) = image(i,j)+25; } } printf("The read image with enhanced contrast is:"ima...
Comments

Related Questions

Is it good practicing c++ in code blocks instead of turbo c++?
Practicing/working on Turbo C++ is always good..because its hard to do comparatively 'code blocks'. seems 'code blocks' has been designed by considering the latest working tools(like Visual Studio from...
Santosh
What is a macro, and how do you use it?
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look...
Sandeep
Can you define which header file to include at compile time?
Yes we can do it by using conditional comilation
Thileshwari
0 0
5
What is = and == in C language?
'=' (Assignment Operator): The single equal sign = is used as an assignment operator. It is used to assign a value to a variable. '==' (Equality Operator): The double equal sign == is used as a relational...
Sayed
0 0
7
How and where do I start learning C programming?
To start learning C programming, you can follow a structured approach that includes both theoretical knowledge and practical implementation. Begin with understanding the basics of C, including variables,...
Gaurav
0 0
7

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

C Program-Infinite Loop[For] Demo
//Header Files #include<stdio.h>#include<conio.h> //Main function void main(){ //Function for clearing screen clrscr(); //Infinite for loop for(;;) { printf("Hello!"); } //Function for...

C Program-Error Handling
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main function void main(){ int dividend=10; int divisor=0; int quotient; //Function for clearing screen clrscr(); ...

Necessity of Theory and Practical in Computer Science.
Upon studying a subject both theory and practical are important. Usually many schools concentrate more on theory and the marks not on the practical. Other and opposite kind of people prefer practical...

C Program to print Block Letter and Small Case Alphabets using C
/* WAP to print Block Letter and Small Case Alpahbets using C*/ //Hint:use ascii code(value) to print #include#include void main(){ int i; clrscr(); //Block Letters Alphabets printf("Block Letters Alphabets\n");...

Can we store different data types in a stack?
Yesterday, one of my Facebook friend asked me this question. My answer is "yes", and in this post I will discuss how could we do this.I am a great supporter of working with unions and I will be using union...

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more