Solved

code for jpg manipulation

Posted on 1999-01-21
7
286 Views
Last Modified: 2010-04-15
i need a source code for mnipulating jpg images. iwant to paste a couple of jpgs on a different larger size jpg.

the source will get the jpgs paths as arguments, and execute the copy and paste.
0
Comment
Question by:liorliat
7 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1258255
Go to http://www.ijg.org for a library that can manipulate JPEG files.
0
 

Author Comment

by:liorliat
ID: 1258256
i'm sorry, but i have been informed that the application sould run on linux/unix, so i'll ask this question on linux.  about ijg,the only code i could find was JPEG compression and decompression. nothing about other manipulations. i'll be glad if you instruct me to a specific place to get code from.
thanks  :)
0
 
LVL 2

Accepted Solution

by:
hougaard earned 300 total points
ID: 1258257
Due to the fact that jpg is a compressed format you will have to do your stuff in steps:

1. Create the target bitmap in memory (uncompressed) malloc(width*height)
2. Load and uncompress the jpg's to another memory location
3. Perform a pixel to pixel convertion from the loaded (uncompressed) jpg into the target bitmap (something like:

XOffset = 100 // X Offset into target bitmap
YOffset = 100; // Y Offset into target bitmap
for (x = 0; x <= Width; x++)
  for (y = 0; y <= Height; y++)
  {
   // DOne with arrays for easy reading - sould be pointers into the allocated bitmap memory
    TargetPixel[Xoffset + x,YOffset + y] = SourcePixel[x,y]
  }

4. Compress the target bitmap (With the jpg compress function from ijg.org)
5. Save the jpg.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:liorliat
ID: 1258258
i know the algorithm, i need the code...  i know it's a lot of code,i need somthing written, like the written files of Tom Lane and the independed jpg group.(i didn't find there what i was looking for).  
thanks a lot   :)

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1258259
See to http://user.cs.tu-berlin.de/~uzadow/paintlib/ 
for C++ code of jpg manipulations
0
 

Author Comment

by:liorliat
ID: 1258260
hougaard, thanks you 4 your answer. i'm sorry about the confused requests....   this time it's finall...   i need a  c  code for compression\decompression jpg files.  i have the IJG code, but it's too much, and too big for me.
can you help me with a precise code ?
thanks(again) and sorry(again) for the bother..
:)
 

0
 
LVL 2

Expert Comment

by:hougaard
ID: 1258261
The best stuff is the IJG code, here is what you need to do with it!

1. Read the libjpeg.doc document ... Good starter info
2. Compile the example.c (Has read and write jpeg file functions!)
2.1 In order to this you will have to build the libjpeg.lib (the example.c includes the libjpeg.h)
2.2 Study the way the library stores the pixels - from this points it becomes easy to do what you want!
4.Change the example.c to include a main()
5. Have a Party!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C#, VS15, StructLayout 1 134
Console based application in Linux 1 89
c++ getting the first 10 characters of a char* string 11 93
Line meaning 9 85
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question