Click here to Skip to main content
15,911,141 members
Home / Discussions / C#
   

C#

 
QuestionThread & timer in Web application C# Pin
ASGuru26-Oct-07 0:18
ASGuru26-Oct-07 0:18 
AnswerRe: Thread & timer in Web application C# Pin
Christian Graus26-Oct-07 0:31
protectorChristian Graus26-Oct-07 0:31 
QuestionLoad and resize a bitmap Pin
Christian Graus26-Oct-07 0:17
protectorChristian Graus26-Oct-07 0:17 
AnswerRe: Load and resize a bitmap Pin
codemunkeh26-Oct-07 0:53
codemunkeh26-Oct-07 0:53 
GeneralRe: Load and resize a bitmap Pin
Christian Graus26-Oct-07 1:10
protectorChristian Graus26-Oct-07 1:10 
AnswerRe: Load and resize a bitmap [modified] Pin
Anthony Mushrow26-Oct-07 1:11
professionalAnthony Mushrow26-Oct-07 1:11 
GeneralRe: Load and resize a bitmap Pin
Christian Graus26-Oct-07 11:47
protectorChristian Graus26-Oct-07 11:47 
AnswerRe: Load and resize a bitmap Pin
Luc Pattyn26-Oct-07 3:25
sitebuilderLuc Pattyn26-Oct-07 3:25 
Hi Christian,

I don't expect there is a general solution, resizing an image file without loading the
entire file that is. For a specific format, you could write your own file decoder.

The PNG format consists of a lot of "chuncks", identified by a type field. There will
be a header (IHDR), some more attributes, then a number of data chunks (IDAT).
I don't expect the IDAT chunks to synchronize with scanlines though.

To get what you want, I would split the input image in "bands" (an arbitrary number of
consecutive scanlines), then do width reduction on each band, assemble the results into
a new image (graphics-form-bitmpa and DrawImage), then do the vertical reduction on the
image level.

If you try to do non-integer vertical reduction on bands you are bound to get artefacts,
such as moire, where the bands touch.

With this approach the overall memory footprint would be reduced by a factor of almost 4,
your linear scale factor that is.

Remark: if your scale factor were an exact integer (it is very close to 4, maybe 1023*1023
would be OK?) I would consider a direct two-dimensional rescale avoiding the input image
footprint altogether.

Smile | :)





Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google


GeneralRe: Load and resize a bitmap Pin
Christian Graus26-Oct-07 11:53
protectorChristian Graus26-Oct-07 11:53 
GeneralRe: Load and resize a bitmap Pin
Luc Pattyn26-Oct-07 14:46
sitebuilderLuc Pattyn26-Oct-07 14:46 
Questionrouting Pin
tuananh230526-Oct-07 0:12
tuananh230526-Oct-07 0:12 
AnswerRe: routing Pin
Christian Graus26-Oct-07 0:18
protectorChristian Graus26-Oct-07 0:18 
Questionrouting Pin
tuananh230526-Oct-07 0:06
tuananh230526-Oct-07 0:06 
AnswerRe: routing Pin
il_masacratore26-Oct-07 3:08
il_masacratore26-Oct-07 3:08 
Questionfire an email after a checkboxlist item was unchecked Pin
alok217126-Oct-07 0:02
alok217126-Oct-07 0:02 
AnswerRe: fire an email after a checkboxlist item was unchecked Pin
codemunkeh26-Oct-07 0:44
codemunkeh26-Oct-07 0:44 
QuestionRun exe on client Machine Pin
Sun Rays25-Oct-07 23:37
Sun Rays25-Oct-07 23:37 
AnswerRe: Run exe on client Machine Pin
Christian Graus25-Oct-07 23:49
protectorChristian Graus25-Oct-07 23:49 
GeneralRe: Run exe on client Machine Pin
J4amieC26-Oct-07 1:12
J4amieC26-Oct-07 1:12 
GeneralRe: Run exe on client Machine Pin
Sun Rays27-Oct-07 0:41
Sun Rays27-Oct-07 0:41 
AnswerRe: Run exe on client Machine Pin
Guffa25-Oct-07 23:58
Guffa25-Oct-07 23:58 
AnswerRe: Run exe on client Machine Pin
darkelv26-Oct-07 1:17
darkelv26-Oct-07 1:17 
QuestionProblem Canceling BindingNavigator (AddItem) Event Pin
azifaliazif25-Oct-07 23:03
azifaliazif25-Oct-07 23:03 
AnswerRe: Problem Canceling BindingNavigator (AddItem) Event Pin
c0ax_lx25-Oct-07 23:57
c0ax_lx25-Oct-07 23:57 
GeneralRe: Problem Canceling BindingNavigator (AddItem) Event Pin
azifaliazif26-Oct-07 1:07
azifaliazif26-Oct-07 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.