Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 2, 2016 10:27:45 AM(UTC)
mrttlemonde

Groups: Registered
Posts: 1


Hello,

I would like to add a 50 pixels white border to a two-page tiff.
Here is my test :

RasterColor whiteColor = RasterColor.fromHtml("#FFFFFF");
String path = "/tmp/scan.tiff";
RasterImage ri = this.rasterCodecs.load(path);
RasterImage whiteRImg = RasterImage.create(ri.getWidth() + 100, ri.getHeight() + 100, 8, 300, whiteColor);
CombineFastCommand combineCmd = new CombineFastCommand(whiteRImg, new LeadRect(50, 50, ri.getWidth()+50, ri.getHeight()+50), LeadPoint.create(0, 0), CombineFastCommandFlags.SOURCE_COPY.getValue());
combineCmd.run(ri);
this.rasterCodecs.save(whiteRImg, "/tmp/test.tiff", RasterImageFormat.TIF_JPEG, 8);


My initial problem is that the autocrop command let all my barcodes too close from the border pages.
There may be another solution?

Thank you in advance.
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 9, 2016 9:57:30 AM(UTC)
Matt.Hight

Groups: Tech Support
Posts: 3


Check out the attached project. It adds a border around a loaded image with this code snippet:

Code:

rasterImageViewer2.Image = new RasterImage(
   RasterMemoryFlags.Conventional, 
   rasterImageViewer1.Image.Width + 50, 
   rasterImageViewer1.Image.Height + 50,
   rasterImageViewer1.Image.BitsPerPixel, 
   rasterImageViewer1.Image.Order, 
   rasterImageViewer1.Image.ViewPerspective, 
   null, null, 0);

FillCommand fillCommand = new FillCommand(RasterColor.Black);
fillCommand.Run(rasterImageViewer2.Image);


I think you can edit this to suit your needs. This project was built using LEADTOOLS version 19

File Attachment(s):
CS_v19_AddBorderDemo.zip (15kb) downloaded 121 time(s).

Edited by moderator Thursday, November 10, 2016 2:46:36 PM(UTC)  | Reason: Syntax highlighting and removed duplicate attachment

Matt Hight
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.079 seconds.