#1
Posted
:
Wednesday, November 2, 2016 10:27:45 AM(UTC)
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.
#2
Posted
:
Wednesday, November 9, 2016 9:57:30 AM(UTC)
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
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 LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
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.