All Projects → davemorrissey → Subsampling Scale Image View

davemorrissey / Subsampling Scale Image View

Licence: apache-2.0
Copyright 2018 David Morrissey, and licensed under the Apache License, Version 2.0. No attribution is necessary but it's very much appreciated. Star this project if you like it!

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Subsampling Scale Image View

TTFancyGifDialog-Android
TTFancyGifDialog makes your Android Dialog Fancy and more Beautiful. A library that makes normal Android Dialog to high level Dialog with many styling options and fully customizable. Make dialog from few lines of code.
Stars: ✭ 61 (-99.15%)
Mutual labels:  android-libs, android-lib
ChipView
A simple Chip based EditText with a searchable ListView
Stars: ✭ 44 (-99.38%)
Mutual labels:  android-libs, android-lib
Typesettings
A Sass or Stylus toolkit that sets type in Ems based on modular scale, vertical rhythm, and responsive ratio based headlines.
Stars: ✭ 380 (-94.68%)
Mutual labels:  scale
Awesome Android
android libs from github or other websites
Stars: ✭ 5,941 (-16.76%)
Mutual labels:  android-libs
Litepager
LitePager,一个轻量级的ViewPager,仿新版网易云歌单广场
Stars: ✭ 563 (-92.11%)
Mutual labels:  scale
Chartjs Plugin Zoom
Zoom and pan plugin for Chart.js
Stars: ✭ 404 (-94.34%)
Mutual labels:  pan
React Svg Pan Zoom
👀 A React component that adds pan and zoom features to SVG
Stars: ✭ 569 (-92.03%)
Mutual labels:  pan
Xlcardswitch
iOS 利用余弦函数特性实现可以居中放大的图片浏览工具
Stars: ✭ 361 (-94.94%)
Mutual labels:  scale
Chordious
Fretboard diagram generator for fretted stringed instruments.
Stars: ✭ 22 (-99.69%)
Mutual labels:  scale
Bloom
🌸 HTTP REST API caching middleware, to be used between load balancers and REST API workers.
Stars: ✭ 553 (-92.25%)
Mutual labels:  scale
Tidb
TiDB is an open source distributed HTAP database compatible with the MySQL protocol
Stars: ✭ 29,871 (+318.54%)
Mutual labels:  scale
Escalator
Escalator is a batch or job optimized horizontal autoscaler for Kubernetes
Stars: ✭ 539 (-92.45%)
Mutual labels:  scale
Iogrid
Multiplayer game engine/framework built using SocketCluster and Phaser
Stars: ✭ 455 (-93.62%)
Mutual labels:  scale
Performance Optimization
Guidance on how to observe, measure, and correct common issues in a cloud-based system.
Stars: ✭ 620 (-91.31%)
Mutual labels:  scale
Drawer Behavior
Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
Stars: ✭ 394 (-94.48%)
Mutual labels:  scale
Depth
Add some Depth to your fragments
Stars: ✭ 789 (-88.94%)
Mutual labels:  scale
Serving
Kubernetes-based, scale-to-zero, request-driven compute
Stars: ✭ 4,238 (-40.62%)
Mutual labels:  scale
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (-21.82%)
Mutual labels:  scale
Any Touch
👋 手势库, 按需2kb~5kb, 兼容PC / 移动端
Stars: ✭ 567 (-92.06%)
Mutual labels:  pan
Ws50 Sync
ws50-sync is a python based program which pulls air quality data from your Withings account and stores it directly in a Domoticz DB.
Stars: ✭ 8 (-99.89%)
Mutual labels:  scale

Subsampling Scale Image View

A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without OutOfMemoryErrors. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.

The view optionally uses subsampling and tiles to support very large images - a low resolution base layer is loaded and as you zoom in, it is overlaid with smaller high resolution tiles for the visible area. This avoids holding too much data in memory. It's ideal for displaying large images while allowing you to zoom in to the high resolution details. You can disable tiling for smaller images and when displaying a bitmap object. There are some advantages and disadvantages to disabling tiling so to decide which is best, see the wiki.

Guides

Migration guides

Versions 3.9.0, 3.8.0 and 3.0.0 contain breaking changes. Migration instructions can be found in the wiki.

Download the sample app

Get it on Google Play

Kotlin Sample App on GitHub

Demo

Demo

Features

Image display

  • Display images from assets, resources, the file system or bitmaps
  • Automatically rotate images from the file system (e.g. the camera or gallery) according to EXIF
  • Manually rotate images in 90° increments
  • Display a region of the source image
  • Use a preview image while large images load
  • Swap images at runtime
  • Use a custom bitmap decoder

With tiling enabled:

  • Display huge images, larger than can be loaded into memory
  • Show high resolution detail on zooming in
  • Tested up to 20,000x20,000px, though larger images are slower

Gesture detection

  • One finger pan
  • Two finger pinch to zoom
  • Quick scale (one finger zoom)
  • Pan while zooming
  • Seamless switch between pan and zoom
  • Fling momentum after panning
  • Double tap to zoom in and out
  • Options to disable pan and/or zoom gestures

Animation

  • Public methods for animating the scale and center
  • Customisable duration and easing
  • Optional uninterruptible animations

Overridable event detection

  • Supports OnClickListener and OnLongClickListener
  • Supports interception of events using GestureDetector and OnTouchListener
  • Extend to add your own gestures

Easy integration

  • Use within a ViewPager to create a photo gallery
  • Easily restore scale, center and orientation after screen rotation
  • Can be extended to add overlay graphics that move and scale with the image
  • Handles view resizing and wrap_content layout

Quick start

1) Add this library as a dependency in your app's build.gradle file.

dependencies {
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
}

If your project uses AndroidX, change the artifact name as follows:

dependencies {
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
}

2) Add the view to your layout XML.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>

3a) Now, in your fragment or activity, set the image resource, asset name or file path.

SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(id.imageView);
imageView.setImage(ImageSource.resource(R.drawable.monkey));
// ... or ...
imageView.setImage(ImageSource.asset("map.png"))
// ... or ...
imageView.setImage(ImageSource.uri("/sdcard/DCIM/DSCM00123.JPG"));

3b) Or, if you have a Bitmap object in memory, load it into the view. This is unsuitable for large images because it bypasses subsampling - you may get an OutOfMemoryError.

SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(id.imageView);
imageView.setImage(ImageSource.bitmap(bitmap));

Photo credits

About

Copyright 2018 David Morrissey, and licensed under the Apache License, Version 2.0. No attribution is necessary but it's very much appreciated. Star this project if you like it!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].