Aurigma Forums
 » 
Graphics Mill
 » 
Discussions – Graphics Mill
 » 
How do I change the Dpi of an image without loading a bitmap?
 
		
        
            
            
	
    | 
Rank: Advanced Member
 Groups: Guest
Joined: 5/10/2017(UTC)
 Posts: 33
 
 Thanks: 10 timesWas 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.   Edited by user Friday, May 12, 2017 4:09:55 AM(UTC)
 | Reason: Not specified | 
	
    | 
             | 
            
         | 
    |  | 
        
        
        
         
		   
        
            
            
	
    | 
Rank: Advanced Member
 Groups: Guest
Joined: 7/28/2003(UTC)
 Posts: 1,660
 
 Thanks: 5 timesWas thanked: 76 time(s) in 74 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
 | 
	
    | 
              1 user thanked Fedor for this useful post. |  | 
    |  | 
        
        
        
    
		
        
            
            
	
    | 
Rank: Advanced Member
 Groups: Guest
Joined: 5/10/2017(UTC)
 Posts: 33
 
 Thanks: 10 timesWas thanked: 1 time(s) in 1 post(s)
 
 | 
            
	      
                  Thanks, that does it. I totally didn't fint that one between the rest. | 
	
    | 
             | 
            
         | 
    |  | 
        
        
        
    
Aurigma Forums
 » 
Graphics Mill
 » 
Discussions – Graphics Mill
 » 
How do I change the Dpi of an image without loading a bitmap?
 
    
        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.