Bring Your Photos to Life with RxLowpoly: A Guide to Crystallized Effects

Mar 23, 2024 | Programming

Unleashing the creative potential of your ordinary photos has never been easier! With the RxLowpoly Android library, you can transform your images into stunning crystallized artworks. In this guide, we’ll walk you through everything you need to know to get started with RxLowpoly.

Table of Contents

Introduction

RxLowpoly serves as an enhancement over XLowPoly with various improvements. Here are some highlights:

  • Fixes **out of memory** crashes by scaling images down in a lossless manner.
  • Provides better quality results with a default point count of 4000, striking a balance between speed and quality.
  • Offers wider input options, including Bitmap, File, Uri, or Drawable resources.
  • Utilizes RxJava for background processing to minimize boilerplate code.

Lowpoly Samples

Check out some stunning transformations from original photos to their low-poly versions:

  • OriginalLowpoly
  • OriginalLowpoly
  • OriginalLowpoly

Installation

To get started with RxLowpoly, simply add the following dependency to your app module’s build.gradle file:

implementation 'com.zebrostudio.rxlowpoly:rxlowpoly:latest_version'

And just like that, you’re ready to start transforming your images!

Library Details

RxLowpoly utilizes the Java Native Interface (JNI) for performance, ensuring speed by employing 64-bit support, which is crucial for compliance with Google’s requirements. This library implements:

  • The Sobel Operator for edge detection.
  • Delaunay Triangulation to create the final low-poly effect.

What’s all this about?

Think of RxLowpoly as a skilled artist and your photo as a blank canvas. The Sobel Operator acts like a brush, tracing the edges, while Delaunay Triangulation creates a triangular mosaic on this canvas. As different shades are filled in, what results is a vibrant crystallized artwork!

Usage Examples

Using RxLowpoly is intuitive. Here are a few usage examples:

Asynchronous Call

RxLowpoly.with(context)
  .input(bitmap)
  .generateAsync()

Scaling the Image Down

RxLowpoly.with(context)
  .input(bitmap)
  .overrideScaling(downScalingFactor)
  .generateAsync()

Setting Quality

RxLowpoly.with(context)
  .input(inputUri)
  .quality(Quality.HIGH)
  .generateAsync()

Critical Analysis

Tests conducted on a Xiaomi Redmi Note 5 Pro show that the input type Bitmap offers the fastest processing. Higher quality levels slightly reduce speed but yield stunning textures. The default quality is thus set to HIGH for the best balance!

Sample App

You can try out various configurations of RxLowpoly in action through the Sample App. Download it today!

How to Contribute

If you encounter any bugs or have suggestions, don’t hesitate to raise an issue on the project’s GitHub repository!

About the Author

Abhriya Roy is an Android Developer with two years of experience in crafting beautiful apps. An open-source contributor and a coding enthusiast, you can connect with her on LinkedIn.

License

This library is licensed under the Apache License, Version 2.0. You can find more details in the project repository.

Troubleshooting

If you encounter issues, here are some tips to help you out:

  • Ensure your dependencies are correctly added.
  • Check for any memory-related errors by adjusting image sizes.
  • If the app crashes, try cleaning and rebuilding your project.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox