How to resize and save a JPEG image?

I want to load a JPEG image, resize it and save it back. I’m using SDL_image. I also found SDL_resize, but the link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle__________________________________________________________________________________
Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and for free at PLUS7. www.tv.yahoo.com.au/plus7

I want to load a JPEG image, resize it and save it back. I’m using
SDL_image. I also found SDL_resize, but the link to the ZIP file is
broken.
What can I do?

Not much, at least with SDL_image. SDL_image has only functions for
reading images, not for writing images. SDL has SDL_SaveBMP(), but it’s hmm
just for BMPs. You will need to use another library for writing JPEGs.On Mon, 25 Jan 2010 02:59:34 -0800 (PST), Phuoc Can Hua wrote:


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt

SDL_gfx has a surface resizer which also supports anti-aliasing. Maybe
it helps with that part of your project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx, double zoomy,
int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created ‘dst’ surface.
‘zoomx’ and ‘zoomy’ are scaling factors for width and height. If
’smooth’ is 1, then the destination 32bit surface is anti-aliased. If
the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a
32bit RGBA format on the fly. Smoothing (interpolation) flags work only
on 32bit surfaces:

–Andreas

Phuoc Can Hua wrote:> I want to load a JPEG image, resize it and save it back. I’m using SDL_image. I also found SDL_resize, but the link to the ZIP file is broken.

What can I do?

P.S. I’m looking for a programing solution, not a tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

  __________________________________________________________________________________

Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and for free at PLUS7. www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”
Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

? ?
???__________________________________________________________________________________
Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

???

  __________________________________________________________________________________

See what’s on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/

When it comes to saving the result into a new image, what to do? AFAIK SDL
does not have functions to write images, just to load them.

Leonardo

2010/1/26 Phuoc Can Hua > thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”
Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle


Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what’s on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That’s not true:
http://www.libsdl.org/cgi/docwiki.cgi/SDL_SaveBMP

But only BMPs are supported.Am 27.01.2010 18:06, schrieb Leonardo Guilherme:

When it comes to saving the result into a new image, what to do? AFAIK
SDL does not have functions to write images, just to load them.


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt

Pygame.Image has “save” support for surfaces:
http://www.pygame.org/docs/ref/image.html#pygame.image.save
Maybe this could be ported into a stand-alone lib.
–Andreas

Leonardo Guilherme wrote:> When it comes to saving the result into a new image, what to do? AFAIK

SDL does not have functions to write images, just to load them.

Leonardo

2010/1/26 Phuoc Can Hua <phuoccanhua at yahoo.com.au
<mailto:phuoccanhua at yahoo.com.au>>

thanks, I will check this out.

_/\__/\__/\__/\__/\__/\_
www.huaonline.com <http://www.huaonline.com>
My Homepage is my Castle


--- On Tue, 26/1/10, Andreas Schiffler <@Andreas_Schiffler <mailto:@Andreas_Schiffler>> wrote:

> From: Andreas Schiffler <@Andreas_Schiffler
<mailto:@Andreas_Schiffler>>
> Subject: Re: [SDL] How to resize and save a JPEG image?
> To: home at huaonline.com <mailto:home at huaonline.com>, "SDL
Development List" <sdl at lists.libsdl.org <mailto:sdl at lists.libsdl.org>>
> Received: Tuesday, 26 January, 2010, 4:50 PM
>
> SDL_gfx has a surface resizer which also supports
> anti-aliasing. Maybe it helps with that part of your
> project.
>
> SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
> double zoomy, int smooth);
> Zooms a 32bit or 8bit 'src' surface to newly created 'dst'
> surface. 'zoomx' and 'zoomy' are scaling factors for width
> and height. If 'smooth' is 1, then the destination 32bit
> surface is anti-aliased. If the surface is not 8bit or 32bit
> RGBA/ABGR it will be converted into a 32bit RGBA format on
> the fly. Smoothing (interpolation) flags work only on 32bit
> surfaces:
>
> --Andreas
>
> Phuoc Can Hua wrote:
> > I want to load a JPEG image, resize it and save it
> back. I'm using SDL_image. I also found SDL_resize, but the
> link to the ZIP file is broken.
> > What can I do?
> >
> > P.S. I'm looking for a programing solution, not a
> tool.
> >
> > Thanks in advance
> > Phuoc
> >
> > _/\__/\__/\__/\__/\__/\_
> > www.huaonline.com <http://www.huaonline.com>
> > My Homepage is my Castle
> >
> >
> >   
>
   __________________________________________________________________________________
> > Yahoo!7: Catch-up on your favourite Channel 7 TV shows
> easily, legally, and for free at PLUS7.
> www.tv.yahoo.com.au/plus7 <http://www.tv.yahoo.com.au/plus7>
> > _______________________________________________
> > SDL mailing list
> > SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
> > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> >
> >   


   
 __________________________________________________________________________________
See what's on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Phuoc,
I am the writer of the SDL_resize lib that’s got the broken link. I’d be
happy to send it to you via email. It’s does what you want in terms of
resizing your image, with very high quality (uses a lanczos3 filter, which
is definitely superior to the rotozoom filter). I can’t help you out on the
saving of the image, beyond the basic BMP save function (SDL_SaveBMP()),
though.

I’ve really got to find a new spot to keep that lib hosted… Any good
suggestions out there? Free webhosting solutions, that is :slight_smile:
-Dave
p.s. I’ll send it to the address I see here (@yahoo.com.au)--------------------------------------------------
From: phuoccanhua@yahoo.com.au (Phuoc Can Hua)
Sent: Tuesday, January 26, 2010 4:12 AM
To: “SDL Development List”
Subject: Re: [SDL] How to resize and save a JPEG image?

thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”
Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle


Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what’s on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Phuoc,
I am the writer of the SDL_resize lib that’s got the broken link. I’d be
happy to send it to you via email. It’s does what you want in terms of
resizing your image, with very high quality (uses a lanczos3 filter, which
is definitely superior to the rotozoom filter). I can’t help you out on the
saving of the image, beyond the basic BMP save function (SDL_SaveBMP()),
though.

I’ve really got to find a new spot to keep that lib hosted… Any good
suggestions out there? Free webhosting solutions, that is :slight_smile:
-Dave
p.s. I’ll send it to the address I see here (@Jeremiah)


thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle


Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what’s on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
On Thu, Jan 28, 2010 at 1:13 AM, David Olsen wrote:
From: “Phuoc Can Hua”
Sent: Tuesday, January 26, 2010 4:12 AM
To: “SDL Development List”
Subject: Re: [SDL] How to resize and save a JPEG image?

— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”

Dave, I’m happy to host SDL libraries on libsdl.org. Just send me an
archive of the web drop and I’ll put it in
www.libsdl.org/projects/SDL_resizeOn Wed, Jan 27, 2010 at 10:13 PM, David Olsen wrote:

Phuoc,
I am the writer of the SDL_resize lib that’s got the broken link. I’d be
happy to send it to you via email. It’s does what you want in terms of
resizing your image, with very high quality (uses a lanczos3 filter, which
is definitely superior to the rotozoom filter). I can’t help you out on the
saving of the image, beyond the basic BMP save function (SDL_SaveBMP()),
though.

I’ve really got to find a new spot to keep that lib hosted… Any good
suggestions out there? Free webhosting solutions, that is :slight_smile:
-Dave
p.s. I’ll send it to the address I see here (@yahoo.com.au)


From: “Phuoc Can Hua”
Sent: Tuesday, January 26, 2010 4:12 AM
To: “SDL Development List”
Subject: Re: [SDL] How to resize and save a JPEG image?

thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”
Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle


Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what’s on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Use a JPEG library! :slight_smile: (I haven’t done that personally, but I use libPNG in
Tux Paint to store users’ drawings in PNG format.)

$ sudo apt-get install libjpeg-dev

;)On Wed, Jan 27, 2010 at 02:06:00PM -0300, Leonardo Guilherme wrote:

When it comes to saving the result into a new image, what to do? AFAIK SDL
does not have functions to write images, just to load them.


-bill!
Sent from my computer

Sam, that’s really generous of you! If I hadn’t just completed a sourceforge
project page for the lib a few minutes ago, I’d take you up on it. :slight_smile:
I’ve updated the lib information on libsdl.org to reflect the new location
of the project.
-Dave--------------------------------------------------
From: slouken@libsdl.org (slouken)
Sent: Thursday, January 28, 2010 5:04 PM
To: “SDL Development List”
Subject: Re: [SDL] How to resize and save a JPEG image?

Dave, I’m happy to host SDL libraries on libsdl.org. Just send me an
archive of the web drop and I’ll put it in
www.libsdl.org/projects/SDL_resize

On Wed, Jan 27, 2010 at 10:13 PM, David Olsen <@David_Olsen> wrote:

Phuoc,
I am the writer of the SDL_resize lib that’s got the broken link. I’d be
happy to send it to you via email. It’s does what you want in terms of
resizing your image, with very high quality (uses a lanczos3 filter,
which
is definitely superior to the rotozoom filter). I can’t help you out on
the
saving of the image, beyond the basic BMP save function (SDL_SaveBMP()),
though.

I’ve really got to find a new spot to keep that lib hosted… Any good
suggestions out there? Free webhosting solutions, that is :slight_smile:
-Dave
p.s. I’ll send it to the address I see here (@yahoo.com.au)


From: “Phuoc Can Hua”
Sent: Tuesday, January 26, 2010 4:12 AM
To: “SDL Development List”
Subject: Re: [SDL] How to resize and save a JPEG image?

thanks, I will check this out.

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

— On Tue, 26/1/10, Andreas Schiffler wrote:

From: Andreas Schiffler
Subject: Re: [SDL] How to resize and save a JPEG image?
To: home at huaonline.com, “SDL Development List”
Received: Tuesday, 26 January, 2010, 4:50 PM

SDL_gfx has a surface resizer which also supports
anti-aliasing. Maybe it helps with that part of your
project.

SDL_Surface * zoomSurface (SDL_Surface *src, double zoomx,
double zoomy, int smooth);
Zooms a 32bit or 8bit ‘src’ surface to newly created 'dst’
surface. ‘zoomx’ and ‘zoomy’ are scaling factors for width
and height. If ‘smooth’ is 1, then the destination 32bit
surface is anti-aliased. If the surface is not 8bit or 32bit
RGBA/ABGR it will be converted into a 32bit RGBA format on
the fly. Smoothing (interpolation) flags work only on 32bit
surfaces:

–Andreas

Phuoc Can Hua wrote:

I want to load a JPEG image, resize it and save it
back. I’m using SDL_image. I also found SDL_resize, but the
link to the ZIP file is broken.
What can I do?

P.S. I’m looking for a programing solution, not a
tool.

Thanks in advance
Phuoc

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle


Yahoo!7: Catch-up on your favourite Channel 7 TV shows
easily, legally, and for free at PLUS7.
www.tv.yahoo.com.au/plus7


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what’s on at the movies in your area. Find out now:
http://au.movies.yahoo.com/session-times/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org