forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scaling JPEG images
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Jun 11, 2009 4:48 am    Post subject: Reply with quote

Ian,

I do all my graphics drawing/painting in a %gr window, by manageing my own virtual screen. Each pixel has 4 attributes; red, green, blue and depth, all stored in my common block. This is to handle hidden line removal and some other effects. The surfaces I draw are limited to flat polygons with linearly varying values of RGBZ.
It is not as efficient/quick as opengl, but is fairly quick, at about 10 to 20 frames per second, for the type of graphics I draw (FEA). For photos it would be a bit slower.
The important point is that it does work fairly well. You could develop your own image definition in memory(RGB), then convert it and dump it.
To speed up the dump process, rather than process pixels, I look for lines of similar colour. This works very well for my FEA images, but would be less effective for photos. ( I think you can also get access to the %gr memory array via USER_SURFACE which would speed it up significantly. I'll have to look at than one day. )

I've found this approach very useful.

John
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Jun 11, 2009 7:52 am    Post subject: Reply with quote

Ian,

I have now looked at your latest example program and it works well. One of the strengths of this simple algorithm is that the colour chosen is a colour that is present in the original picture and not a modified colour that is probably not present, if an averageing method is chosen.

John
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Jun 11, 2009 12:40 pm    Post subject: Reply with quote

Hi Ian,

Your solution follows my first suggestion (use colour of nearest old pixel). I'm glad it works.

Interpolation suggestions were for the situation that the result wasn't good enough. Mention of Lagrangian interpolation was to frighten you off doing anything complicated!

Every time we get a really satisfactory solution to a problem, it gets lost in the general morass of questions and unsatisfactory answers in these forums. Wouldn't it be a good idea to have a repository of good solutions?

Eddie
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Thu Jun 11, 2009 1:22 pm    Post subject: Reply with quote

I'll second that Eddie!

An online library of useful source code routines would be good, rather than have some vague recollection that I once saw a solution posted to that problem in some thread you have forgotten the name of!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group