Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
SebastianR  
#1 Posted : Friday, May 12, 2017 3:58:15 AM(UTC)
SebastianR

Rank: Advanced Member

Groups: Member
Joined: 5/10/2017(UTC)
Posts: 33

Thanks: 10 times
Was thanked: 1 time(s) in 1 post(s)
Hello,
to process a large image I need to use a pipeline. The Dpi can only be set for a bitmap or an imagegenerator.

I came up with the following so far:
Code:
using (var reader = ImageReader.Create(@"..\largeinput.tif")
using (var generator = new ImageGenerator(reader, RgbColor.White)
using (var combiner = new Combiner(CombineMode.AlphaOverlay, reader))
using (var writer = new TiffWriter(@"..\output.tif");)
{
    generator.DpiX = 123;
    generator.DpiY = 123;
    Pipeline.Run(generator + combiner + writer);
}


The use of an imagegenerator also implies the use of a backgroundcolor, which I have to get from the readers bitmap again (because of
Code:
bitmap.ColorManagement.BackgroundColor;
beeing the only source of a background color).
I wonder wether there is a easier way to assign Dpi. Think

Edited by user Friday, May 12, 2017 4:09:55 AM(UTC)  | Reason: Not specified

Fedor  
#2 Posted : Friday, May 12, 2017 4:12:07 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,556

Thanks: 5 times
Was thanked: 62 time(s) in 61 post(s)
You can use the ResolutionModifier class to change resolution:

Code:
using (var reader = ImageReader.Create(@"..\largeinput.tif"))
using (var resolutionModifier = new ResolutionModifier(123, 123))
using (var writer = new TiffWriter(@"..\output.tif"))
{
	Pipeline.Run(reader+ resolutionModifier + writer);
}
Best regards,
Fedor Skvortsov
thanks 1 user thanked Fedor for this useful post.
SebastianR on 5/12/2017(UTC)
SebastianR  
#3 Posted : Friday, May 12, 2017 4:25:31 AM(UTC)
SebastianR

Rank: Advanced Member

Groups: Member
Joined: 5/10/2017(UTC)
Posts: 33

Thanks: 10 times
Was thanked: 1 time(s) in 1 post(s)
Brick wall Thanks, that does it. I totally didn't fint that one between the rest.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.