Click here to Skip to main content
Click here to Skip to main content

Image Enabled Windows Store Applications with LEADTOOLS

The advanced WinRT imaging technology in LEADTOOLS will include everything developers need to build imaging enabled Windows Store applications including support for loading and saving over 100 file formats, PDF and PDF/A, touch screen enabled viewer controls, annotations and image processing.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

With Windows 8 now here, developers are eager to start working on the next generation of applications. LEAD Technologies, the award winning provider of imaging development toolkits, is ahead of the game and has released its new WinRT SDK that will help any developer interested in getting a head start at developing imaging enabled Windows Store applications for desktops, tablets and Windows Phones.

The advanced WinRT imaging technology in LEADTOOLS includes everything developers need to build imaging enabled Windows Store applications including support for loading and saving over 150 file formats, PDF and PDF/A, touch screen enabled viewer controls, annotations and image processing. The viewer controls work seamlessly with the new Windows Store application style and feature multi-touch input and interactive modes such as Pan, Scale, Pinch & Zoom, Magnifying Glass and annotations. Beyond the standard image display and processing functionality, LEAD has also ported its advanced OCR, Barcode, PDF, DICOM and PACS technology into native WinRT libraries allowing your image enabled Windows Store applications to run at maximum efficiency.

Key WinRT Features in LEADTOOLS SDKs

  • Native WinRT libraries for Win32, x64 and ARM
  • Develop a single application that works on any Windows 8 compatible desktop, tablet or mobile device
  • Load, convert and save more than 100 image formats such as TIFF, JPEG2000, PDF, and PDF/A
  • Convert a LEADTOOLS RasterImage to/from Windows Runtime ImageSource and WritableBitmap
  • Interactive image viewers
    • Supports both mouse and multi-touch gesture input
    • Built-in interactive modes such as pan, scale, pinch and zoom, magnifying glass and more
    • Drag and Drop
    • Scale to Gray, Bicubic and Resample image display
    • Window level 8-16 bit extended grayscale
  • Over 200 advanced Image processing functions for document cleanup (deskew, remove lines, hole punches, borders, etc.), color correction, edge detection, image enhancement, artistic effects and more
  • Comprehensive Annotation and Markup including geometric shapes, sticky note, redact, highlight and rubber stamp
  • Detect, read and write Barcodes such as UPC, EAN, Code 128, Data Matrix, QR Code and PDF417
  • Recognize and convert text in images using OCR
  • Load, view, process and save DICOM 

The WinRT Code

In the following example, we will implement the basic foundations of any image enabled application: loading, displaying, processing and saving an image. LEADTOOLS makes all of this possible in only a few lines of code with its fully-featured, high level and programmer friendly controls and classes.

To load an image, use the RasterCodecs object. This class supports loading an image from a variety of sources, such as a physical file, a StorageFile, IInputStream, etc. The following snippet shows how to use the Windows.Storage.Pickers.FileOpenPicker class to select and load a PDF image:

// Show the file picker
var picker = new FileOpenPicker();
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.ViewMode = PickerViewMode.List;
picker.FileTypeFilter.Add("*.pdf");
StorageFile file = await picker.PickSingleFileAsync();
 
// Create a RasterCodecs object
RasterCodecs codecs = new RasterCodecs();
 
// Load the selected file as a RasterImage
RasterImage rasterImage = await codecs.LoadAsync(LeadStreamFactory.Create(file));

Saving an image is done in a similar manner as loading an image and makes use of the FileSavePicker and its built-in asynchronous events to get the file object to which RasterCodecs.Save can write the image data out as a stream.

// Pick the output file
var picker = new FileSavePicker();
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.ViewMode = PickerViewMode.List;
picker.FileTypeFilter.Add("*.tif");
StorageFile file = await picker.PickSaveFileAsync();
 
// Save the PDF we loaded as TIFF
codecs.Save(rasterImage, leadStream = LeadStreamFactory.Create(file), RasterImageFormat.Tiff, 0);

Displaying images is extremely simple with the LEADTOOLS RasterImageViewer control. After installing the control into visual studio, simply drag and drop the control from the toolbox into your XAML page:

<Page
   ...
   <Grid>
      <Controls:RasterImageViewer x:Name="rasterImageViewer1" />
   </Grid>
</Page>

Then assign the RasterImage we loaded previously to the viewer’s Image property:

rasterImageViewer1.Image = rasterImage

Image processing, in the broadest sense, is the bread and butter of imaging applications because that’s where the most advanced technology is put on display. In addition to your traditional image manipulations and effects, features such as OCR and barcode are also possible with LEADTOOLS’ native WinRT libraries. Most image processing can be accomplished with only a couple lines of code, such as inverting the image’s colors shown below:

InvertCommand invert = new InvertCommand();
invert.Run(rasterImage);

LEADTOOLS can also be used to fill in the blanks or extend additional imaging functionality to your existing application by offering interoperability between LEADTOOLS’ RasterImage and the standard Windows Runtime objects such as ImageSource and WritableBitmap. For example, you can add PDF support to your existing application by using LEADTOOLS to load a PDF into an ImageSource:

// Convert to ImageSource
ImageSource imageSource = RasterImageConverter.ConvertToImageSource(rasterImage, ConvertToImageOptions.None);

// Use ImageSource object as needed in your existing application...

// Convert back to RasterImage for LEADTOOLS functionality
rasterImage = RasterImageConverter.ConvertFromImageSource(imageSource, ConvertFromImageOptions.None

There you have it: a solid foundation for developing image enabled Windows Store applications. With LEADTOOLS, developing the next generation of powerful, fast and fully-featured Windows 8 desktop, tablet and mobile phone apps is right at your fingertips. 

Conclusion

LEADTOOLS provides developers with access to the world’s best performing and most stable imaging libraries in an easy-to-use, high-level programming interface enabling rapid development of business-critical applications.

Its WinRT SDK is only one of the many technologies LEADTOOLS has to offer. For more information on our other products, be sure to visit our home page, download a free fully functioning evaluation SDK, and take advantage of our free technical support during your evaluation.

Download the Full WinRT Example

You can download a fully functional demo which includes the features discussed above. To run this example you will need the following:

Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.

For More Information on WinRT Imaging with LEADTOOLS

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

LEADTOOLS Support
Help desk / Support LEAD Technologies, Inc.
United States United States
With a rich history of over twenty years, LEAD has established itself as the world's leading provider of software development toolkits for document, medical, multimedia, raster and vector imaging. LEAD's flagship product, LEADTOOLS, holds the top position in every major country throughout the world and boasts a healthy, diverse customer base and strong list of corporate partners including some of the largest and most influential organizations from around the globe. For more information, contact sales@leadtools.com or support@leadtools.com.
Group type: Organisation (No members)


Follow on   Twitter   Google+

Comments and Discussions

 
QuestionExtract Images? PinmemberKalpana Volety12-Jan-13 1:41 
AnswerRe: Extract Images? PingroupLEADTOOLS Support16-Jan-13 2:15 
Kalpana,
Currently, our toolkit doesn't support extracting images from a PDF file. However, we have a pending request for that feature and expect our engineers to add it soon. If you are interested in this feature, send an email to support@leadtools.com, to add your contact information to that feature, and let you know when it's released.
LEADTOOLS Support
LEAD Technologies Inc.
LEADTOOLS Imaging SDK Home Page

GeneralRe: Extract Images? PinmemberKalpana Volety22-Jan-13 10:43 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 7 Jan 2013
Article Copyright 2012 by LEADTOOLS Support
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid