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

In which program we use character constants?
For the name of months, animal, colors we do use it.
Mona
Why is C still so popular?
C is often taught as an introductory programming language in computer science courses due to its simplicity and close-to-the-hardware nature. This ensures a continuous influx of developers familiar with...
Chitra
0 0
5
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
What is C language used for?
C language is a versatile programming language commonly used for system programming, developing operating systems, embedded systems, and creating various applications ranging from game development to scientific...
Anil
0 0
5
What are the applications of C programming?
Hi Poulami Hope you are doing good. C programming language is a versatile and widely used language that has found applications in various domains. Some of the key applications of C programming include: 1....
Poulomi
0 0
6

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-Error Handling[Program Exit Status]
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main Function void main(){ int dividend=20; int divisor=5; int quotient; //Function for clearing screen clrscr();...
S

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...


Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

C Program Sample Application
//Standard Library Functions(Header Files used) #include<stdio.h> #include <conio.h> //Main method int main() { // function for clearing screen clrscr(); // function to print the output...
S

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

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