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

What is the best website to learn c language?
Programming is learnt by practice. I would suggest you to refer the book by Dennis Ritchie on C programming to start with.
Nom
What are all the data types in C programming with their details?
C programming language supports several data types, which are categorized into two main groups: primitive or basic data types and derived data types. Primitive data types include: Integers: Represent...
Ganga
0 0
6
Can we pass arguments in the main function in C language?
Yes. it is possible to pass arguments into the main function.
Mukesh
0 0
7
Other than in a for statement, when is the comma operator used?
Example : int i,j; i=(10,20,30,40); j=10,20,30,40; printf("%d",i); printf("%d",j); // in this program output of i will be 40 and j will be 10 // In interviews you can face such type of comma operator related questions.
Sanjay
How do you print an address?
int main(){ int a=5; printf("Address of variable a is: %d",&a); return 0; }
Prakash
2 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

INTRODUCTION TO PROGRAMMING LANGUAGES
Language is a medium for communication. If we want to perform anything with another person, we can know the human language as a human being. Similarly, if we want to perform anything with a computer, we...

How do i get best Campus / Off Campus Placement?
Companies are looking for Skilled Freshers. So build your technical skills while doing MCA / BTech / BCA / BSc (IT or CS) into below areas- 1. Strong your programming & debugging skills ...

Is It Fine To Write “void main()” Or “main()” In C/C++?
The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming...

Why we need to learn Programming languages?
Language is medium for communication. If two parties like to communicate or exchange the thoughts they must know a language. Language should be understandable by both the Parties. For example A wants to...

Some interview questions for freshers on C language
Q1. What are the two forms of #include? There are two variants of #include. The one is #include and the other one is #include”file”. In general the first form that is #include is used to...

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