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

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

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

Related Questions

What is the difference between text and binary modes?
By default files are text mode. Binary modes are machine readable form.
Raj
How would you round off a value from 1.66 to 2.0?
using ceil function. i.e. ceil(1.66)
Dhanya
0 0
6
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

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

Ask a Question

Related Lessons

Facts about C language
C programming language was developed in 1972 by Dennis Ritchie at AT&T Bell Labs. It was developed to overcome the problems of languages such as B, BPCL. It was developed to write the Unix operating...

Program to swap the value of two variables without using third variable(simplest way)...
int main() { int a=10,b=20; printf("values of a before swap ="%d,a); printf("values of b before swap ="%d,b); a=a+b; b=a-b; a=a-b; printf("******************"); printf("values of a after swap...

Find out the Output of the following with reason and get C Language Training fess less by 10%
1. void main() { clrscr(); printf(5+"Beautifull"); getch(); } 2. void main() { int a=50; clrscr(); ...

Static and dynamic libraries
A library is a package of code that is meant to be reused by many programs. A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When...

Basics Of C And C++
C++ is powerful, highly flexible, and adaptable programming language that allows software engineers to organise and process information quickly and effectively. But this high-level language is relatively...

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 >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

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