Giter Club home page Giter Club logo

subsampling-scale-image-view's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

subsampling-scale-image-view's Issues

Add OnFailed Listener

Hi, could you please add a listener to do something when this method:

BitmapInitTask.doInBackground()

catches an exception and sends the message: E/SubsamplingScaleImageView﹕ Failed to initialise bitmap decoder

it would be really useful to load a default resource, hide the view, etc. in case the image cannot be displayed

Get whole view as a bitmap

I made some drawing on your great view. Now I want to save it as an image. I tried view.getDrawingCache() and view.getBackground() but both of them gives me the visible area only. Could you show me a way to save the whole view as a bitmap? (sorry for being a headache)

Cannot respect EXIF orientation

Before the issue, your project is amazing, solved my problem smoothly, no more OOM in my project. Thanks a lot.

The landscape photo is correctly showed, however, most my portrait photo is displayed in wrong orientation. After digg the code, I notice the BitmapRegionDecoder, just like the BitmapFactory.decodexxx(), doesn't support load the bitmap with correct orientation.

With normal ImageView, I can use the solution found on SO:

http://stackoverflow.com/questions/3647993/android-bitmaps-loaded-from-gallery-are-rotated-in-imageview

However, with this ImageView, there is not much I can do. Could you implement the orientation feature on this ImageView? Thanks.

Reference:

Stop allocating objects in draw

Currently there are a lot of objects that are created in each call to draw.

For example the for ( .. : ..) creates an iterator and there are plenty of Rect's that are created, it would be great if some/all could be created once instead.

OutOfMemory Exception on Samsung Devices

Hello, first of thank you for creating a great library and maintaining it. Totally awesome! You've managed to solve a problem many of us android devs face.

I'm facing an issue where some of the users get an OutOfMemory Exception. I'm using the following code to set the map:

int iDeviceDpi = getResources().getDisplayMetrics().densityDpi;
float fZoomScale;
if (iDeviceDpi <= 240) {
fZoomScale = 0.85f;
} else {
fZoomScale = 1.4f;
}

_imgMap.setImageResource(R.drawable.map);
_imgMap.setDoubleTapZoomScale(fZoomScale);

I'm also using a PNG of about 2MB, and the file size is 5000x4000. It is a map and should not have transparencies, I've also made sure to Uncheck 'Transperency' option in Photoshop just to make sure.

I'm looking for most reliable way to have this working on as many devices as possible, so open to further workaround or tweaks you may advise of. I can also save the file as JPG if that helps.

Thanks in advance!

quick initial render for very large images?

I would like to use this library for some very large jpeg images (20480x20480, about 20mb). Putting one of the images into your sample, I see that the initial load takes 5 seconds on my Nexus 7. That's pretty decent for such a large image (my laptop takes two or three seconds, too), but I wonder if there would be a way to extend your library to allow for a pre-scaled smaller image to be displayed while the library is working away on a large one, for the sake of instant user gratification. After the initial render, your library's scrolling is really smooth, and it could make for a great improvement in my app (LunarMap, which currently uses a kludgy method with lots of pre-rendered tiles at different zoom levels).

I could extend your library in this way, but you will know a lot better how to most neatly implement it, and how it would most neatly fit with your ideas how the API works. Advice would be appreciated.

Maven integration

Hi, would it be possible to upload this library to maven central?

Provide an easier way of drawing on top of the image

I need to be able to draw markers on a very large image, the markers should move and scale as the image moves and scales.

As of now I haven't found any way of doing this since most of the members are private.

Ideally it would be nice to be able to call a function with the coordinates in the full sized image and get the on screen coordinates.

Something like this:

private final Point tempPoint = new Point();
private final Paint markerPaint = new Paint();
private float markerRadius;
private List<Marker> markers;

@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    for (Marker : markers) {
        drawMarker(marker, canvas);
}

private void drawMarker(Marker marker, Canvas canvas) {
    transformImageCoordinatesToScreenCoordinates(marker.coordinates, tempPoint);
    canvas.drawCircle(tempPoint.x, tempPoint.y, markerRadius, markerPaint);
}

decrypt image before loading into view

hello there, and thank you for your patient :)
i encrypted some big image(jpeg), with AES256, and i decode it in java, and get Byte[] or InputStream of my image file, but, how can i use this returned Byte[](or InputStream) in your ImageView?
i searched in you documents and i just found that you only provided methods that load files into view, can i use any trick to load my encoded big image(jpeg) file, with your library?
thank you very very much!

Conflict between Move of the image and Swipe of ViewPager

I'm working on a gallery project, which can show photos one by one, pinch and zoom to see the details, and swipe to the previous or the next photo.

So, I put SubsamplingScaleImageView into a fragment, and using ViewPager to do the swipe thing. Both zoom and swipe works, however, when I zoom in the photo, and try to move horizontally, it will trigger the swipe event, so, the move failed and the UI go to the next photo.

Move the photo vertically will not trigger the swipe event, and if I move vertically first, without release my finger, and then move horizontally, it will not trigger the swipe event, either.

I think the more logical behavior should be that, when zoomed in, move horizontally will not trigger the swipe event, until it reach the boundary of the photo.

Pinch and Zoom stop working after setOnClickListener()

What I want to do is that when click the image, some information panel will show and hide. To do that, I called:

mImageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    showInfoBar(!mShowInfo);
                }
            });

The onClick() has been called correctly, however, I cannot pinch and zoom anymore.

I also tried by setOnTouchListener() to do the same thing, however, onTouch() seems never been called.

java.io.IOException: Image failed to decode using JPEG decoder - Samsung Galaxy S3/S4

Hi,

Thanks for the lib, has been working great for me until I tried using it on a Samsung Galaxy S4, and since then have been receiving the following error.


Failed to initialise bitmap decoder
    java.io.IOException: Image failed to decode using JPEG decoder
            at android.graphics.BitmapRegionDecoder.nativeNewInstance(Native Method)
            at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:131)
            at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:226)
            at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapInitTask.doInBackground(SubsamplingScaleImageView.java:1016)
            at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapInitTask.doInBackground(SubsamplingScaleImageView.java:992)
            at android.os.AsyncTask$2.call(AsyncTask.java:287)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
            at java.util.concurrent.FutureTask.run(FutureTask.java:137)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)

I'm fairly sure it's something to do with the JPEG I'm trying to use. It's been converted from PDF to JPG using Imagick on a server. Maybe you can enlighten me?

Thanks.

How do I add pins on ImageView

Maybe this isn't the right place to ask this question. I want to add some pins, as an ImageView(preferably, because I have to open an info window on click) or as a Drawable. I tried to subclass your view and draw a rect on onDraw but the rect is not scrolling. Do you have any idea how to do that? Could you show me a road to do so?

Is possible using this component with layout wrap_content?

Hi,

please, is possible using this component with layout wrap_content in width and height? When I set this value, view is over all display and after load image it is resized, but panning and zooming are broken - image is not visible whole, panning not work when zoom is out and when I zoom, panning is possible only with partial content.

And if this view is possible using with wrap_content, why is over all display before image file loading? (This breaks dialog in which this view is placed.)

Thank you for help.

setup library

what is the setup gradle method for this library?

Image padding

Hey, just discovered the lib and great job.

I'm currently using PhotoView which allows padding on images. As far as I can tell padding is ignored when determining the initial image size when using subsampling-scale-image-view.

If it helps this was the previous issue raised for PhotoView:

Baseflow/PhotoView#29

Cheers

recycle method required

Hi!

It would be greate to have a public method for release all resources like private method reset(boolean newImage).

Extract an image from SubsamplingScaleImageView?

I am using SubsamplingScaleImageView to allow users to crop a photo by using gestures. I modified the library to overlay additional elements over the image (a logo and a tint). Is there any easy way to extract the photo from the view while preserving the zoom factor, position of the image and the overlays?

I've tried using buildDrawingCache()/getDrawingCache() but it's not a good solution because the final image size depends on the resolution of the screen. On a Full HD I get 1080x1080, but on lower res screens I can get resolutions like 480x480 which is not enough since I need at least 800x800.

Half of the asset is grayscaled

Half of the image is decoded grayscale. I'm on 5.0.1 (didn't test the rest). I'll upload the file here maybe you can reproduce the issue. I don't know if github process the image so I'll upload to dropbox too.

gsa_map

Why do I get "Bitmap too large to be uploaded into a texture" error

I use picasso to load the bitmap from network. Small images are loaded, with larger images I get "Bitmap too large to be uploaded into a texture" error (a lot of them). Tiling is not disabled.

Bitmap too large to be uploaded into a texture (5000x2813, max=4096x4096)

ACTION_DOWN event is never propagated to super

I have a class that extends from view to let user draw on a view.

I changed the base class of SubSamplingScaleImageView to my own class rather than View. Everything worked as expected except the fact that onTouchEvents ACTION_DOWN, SubSamplingScaleImageView never gives an opportunity for super to do anything.

A possible solution that I came up with is:
I have added super.onTouchEvent(event); just before the return statement for case MotionEvent.ACTION_DOWN and it works as expected. I was tempted to change return true with return super.onTouchEvent(event) but that did not felt right as it breaks the guarantee you want in your code that all other events should still be called no matter what and if super returned false, it breaks that guarantee.

I would love to hear your thoughts and a possible fix to make SubSamplingScaleImageView "more" super friendly.

WeakReference null detect

I found that you detect whether WeakReference is null with "WeakReference != null", I think it should be "WeakReference.get() != null",such as:

if (decoderRef != null && tileRef != null && viewRef != null) {
...
}

should be modified into:

if (decoderRef.get() != null && tileRef.get() != null && viewRef.get() != null) {
...
}

How to detect really rendered image in view?

Hi, thank you very much for this component. On phones work very well, but I have problem on tablet when width has 800px. Image is loading by two tiles, but with time delay. I need detect completed loading and rendering for create "screenshot" of visible area for using in other view. Because onImageReady() is called in own thread and I must do any UI action, I created child class and override onDraw() method where I detect first calling when isImageReady() return true. On phones (i.e. lower width) this work perfectly, but on large width no - when is triggered my event in onDraw() (because isImageReady() return true), only first tile is rendered - but in debug mode all tiles has rendered debug info. So is any way how to safe detect complete rendering?

Image Zoom Blurry in Some Parts of the Image

Hello - reaching out with an odd issue that I have a hard time reproducing. A number of my users are reporting that when they zoom in on some parts of the image, it just stays blurry and never clears up.

What I mean by that is, whenever you zoom in on an image, its a bit blurry at first but then clears up as the processing takes place. With these reports users are saying that in certain areas of the image always stay blurry on zoom no matter how long they wait. But other parts of the image are ok.

From what I see this is on Samsung devices, a number of reports are from Galaxy S5.

This is a bit odd as I never saw anything like this in my own testing with 15 devices. Have you experienced anything similar, and if so how to best tackle this issue?

Thanks!

SubsamplingScaleImageView gives me a lot of force closes

right now I'm using https://github.com/davemorrissey/subsampling-scale-image-view by http://stackoverflow.com/users/2719186/dave-morrissey to pinch to zoom into my image.

It works perfectly for my Galaxy S4 and my Galaxy Nexus but my app force closes for a lot of my users.
For me it is not possible to recreate the errors...

java.lang.OutOfMemoryError (Galaxy S 4 (jflte), Galaxy S III LTE (m3), Optimus G Pro (geefhd), ...)
in android.graphics.BitmapRegionDecoder.nativeDecodeRegion

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapRegionDecoder.nativeDecodeRegion(Native Method)
at android.graphics.BitmapRegionDecoder.decodeRegion(BitmapRegionDecoder.java:382)
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:640)
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
... 4 more

java.lang.NoSuchFieldError (MOST COMMON ERROR) (Galaxy S II (GT-I9100), Galaxy Pocket (GT-S5300B), Xperia Play (R800i),Optimus 2X (p999),...)
in com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setImageAsset

java.lang.NoSuchFieldError: com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapInitTask.SERIAL_EXECUTOR
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setImageAsset(SubsamplingScaleImageView.java:135)
at com.example.gta5toolbox.Map.onCreate(Map.java:70)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)

java.lang.NullPointerException (Galaxy S II (GT-I9100), Galaxy S 4 (ja3g), Xperia tipo (ST21i),...)
in com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.viewToSourceCoord

java.lang.NullPointerException
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.viewToSourceCoord(SubsamplingScaleImageView.java:692)
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.getCenter(SubsamplingScaleImageView.java:771)
at com.example.gta5toolbox.Map.onSaveInstanceState(Map.java:88)
at android.app.Activity.performSaveInstanceState(Activity.java:1115)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1185)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3325)
at android.app.ActivityThread.access$700(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)

incorrect displaying of some jpegs

14114382974140
This file (md5: 2314425c399561cb6d75f7aa3c8eeab7) is displaying incorrectly in subsampling-scale-image-view (and can't reproduce this bug in other apps).
It looks like this:
14119475986950

What could be the reason?

can i use it with fit view and fix zoom?

first, thank you for you awesome library, i have someproblem when i want to use it, i want to fit an image from height to entire height of screen, and scroll width like image below
Image of what i want

is there any way to fix the zoom level, and fit the image, like above into screen?

Switch to page on zoomed image not always works

SubsamplingScaleImageView, line 539.

Changed to:

if (lastX == vTranslate.x || (lastY == vTranslate.y && dy > 10) ){
   isPanning = true;
} else if (dx > 5 || lastX != vTranslate.x) {
   // Haven't panned the image, and we're at the left or right edge. Switch to page swipe.
   maxTouchCount = 0;
   handler.removeMessages(MESSAGE_LONG_CLICK);
   getParent().requestDisallowInterceptTouchEvent(false);
 }

Large, irregular size images

Hi,

Did you tested SubsamplingScaleImageView on irregular size images, for example 480x4000? I know it should worked, but is it optimized? I'm looking for an idea to display it, cause making listview with N splited images is not a best workaround, especially when you want to zoom and pan.

Out of Memory when rotating

Hi, some users reports Out of Memory when they use rotate of viewed image. On my device (Samsung Galaxy Note II) is this problem too. I tested it on version 2.3.0 also but this problem is there still.
Rotate button has this simple functionality:

int actualOrientation = mPicture.getOrientation();
mPicture.setOrientation(actualOrientation == 270 ? 0 : actualOrientation + 90);

I add logs to SubsamplingScaleImageView.BitmapTileTask.doInBackground() to synchronized block before decodeRegion and before createBitmap with tag SUBSAMPLING ROTATE (this is in exception log below).
The proble is that bitmap gets big dimensions from decodeRegion - dimensions are original of image source with sampleSize = 1.
Is there another procedure for change orientation for eliminate Out of Memory?

D/SUBSAMPLING ROTATE﹕ tile: Rect(0, 0 - 2448, 3264); sampleSize: 1
D/dalvikvm﹕ GC_FOR_ALLOC freed 5088K, 41% free 27412K/45956K, paused 25ms, total 26ms
I/dalvikvm-heap﹕ Grow heap (frag case) to 43.484MB for 15980560-byte allocation
D/dalvikvm﹕ GC_FOR_ALLOC freed 329K, 31% free 42689K/61564K, paused 17ms, total 17ms
D/SUBSAMPLING ROTATE﹕ bitmap dim: 3264 x 2448
D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 31% free 42689K/61564K, paused 15ms, total 15ms
I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 15980560-byte allocation
D/dalvikvm﹕ GC_BEFORE_OOM freed 70K, 31% free 42618K/61564K, paused 27ms, total 27ms
E/dalvikvm-heap﹕ Out of memory on a 15980560-byte allocation.
I/dalvikvm﹕ "AsyncTask #2" prio=5 tid=12 RUNNABLE
I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x4368dde0 self=0x5b526ce0
I/dalvikvm﹕ | sysTid=31125 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1532129584
I/dalvikvm﹕ | state=R schedstat=( 562850949 168737745 1402 ) utm=46 stm=10 core=3
I/dalvikvm﹕ at android.graphics.Bitmap.nativeCreate(Native Method)
I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:703)
I/dalvikvm﹕ at android.graphics.Bitmap.createBitmap(Bitmap.java:636)
I/dalvikvm﹕ at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:1197)
I/dalvikvm﹕ at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:1167)
I/dalvikvm﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
I/dalvikvm﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
I/dalvikvm﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
I/dalvikvm﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
I/dalvikvm﹕ at java.lang.Thread.run(Thread.java:841)
I/dalvikvm﹕ [ 03-09 10:24:31.503 31026:31125 W/dalvikvm ]
    threadid=12: thread exiting with uncaught exception (group=0x4195b700)
E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:299)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
            at java.util.concurrent.FutureTask.run(FutureTask.java:239)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.OutOfMemoryError
            at android.graphics.Bitmap.nativeCreate(Native Method)
            at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
            at android.graphics.Bitmap.createBitmap(Bitmap.java:703)
            at android.graphics.Bitmap.createBitmap(Bitmap.java:636)
            at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:1197)
            at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$BitmapTileTask.doInBackground(SubsamplingScaleImageView.java:1167)
            at android.os.AsyncTask$2.call(AsyncTask.java:287)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
D/xxxFragment﹕ onPause
I/com.sjl.util.Foreground﹕ still foreground
V/GAV4﹕ Thread[GAThread,5,main]: Loaded clientId
D/xxxFragment﹕ onDetach
E/ViewRootImpl﹕ sendUserActionEvent() mView == null

Thanks...

P.S.: let me know if you need my image file for testing please

EDIT 1: for this is not relevant if image is zoom out or in in view component.

EDIT 2: btw this exception is catched for Exception in BitmapTileTask.doInBackground(), but OutOfMemory is not its child and because it is in async task it is not possible catch in my application. Please add catching OOM.

EDIT 3: hm, catching OOM is not recommended, e.g. http://stackoverflow.com/questions/1692230/is-it-possible-to-catch-out-of-memory-exception-in-java

Moiré patterns occur at certain zoom levels

It's a bit hard to tell by the image but the sky in the image has a dot like pattern that is quite obvious on a real device:
Example

This can be solved by using Config.ARGB_8888 instead of Config.RGB_565.

I totally understand why 565 is default but it would be nice if you could choose which one that is used without having to create a whole new custom decoder.

Loaded bitmap is "pixelated"

Some images are loading in very poor quality. It's always the same images, but I can't figure out what they have in common. Here is the example of image and a screenshot how it looks like on a device. (btw, I use subsampling view). The issue persists on every device I tried and also on genymotion emulator, so I think it's a bug
sun-ken-rock-v01-c03---20
image

Regional bitmap coding

hi
can i write regionally several images on a big blank jpeg image(10000*10000 pixel) on device's storage using this library and read the final image?
exactly the opposite of what BitmapRegionDecoder does in it(without out of memory error).
thanks

Fatal signal 11 (SIGSEGV) while debugging.

This only happens while debugging. Any idea why this happens? Setting a breakpoint to your sample app can reproduce this.

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x3d in tid 15818 (JDWP)

implementing Gyroscope moving

hello,
thank you for your awesome, life saver library! <3
i want to move a "SCALE_TYPE_CENTER_CROP" type image with gyroscope, i can get gyro data in x-axis for example, and now,for example i can use smoothScrollBy() in Horizontalscrollview to scroll throw view with gyroscope,
but how can i move image, with code in your custom view?

myview

take a look at my previous question, that you solved,
#21
i had this view now in my app, thank to you, but i want to handle scrolling, with touch or gyroscope!
how can i implement this? i didn't find any method thats belong to scrolling with code.

thank you.

Re sample code

First of all I would like to appreciate you for your incredible contribution. After spending much time on internet, finally i got best solution for Image caching of large image from you.

I gone through the code, for me its difficult to understand.
My request you to Can you pls explain me a flow via Diagram?

How could i make code as simple as possible?

A question about magazine

Hi,

I Have a magazine in two images(odd page and pair page), but I want to load these images in one subsampling-imageview.
How do I make this? Now a days, I get these two images and make one image and after load to subsampling, but this is so slow.

private class CreatePage extends AsyncTask<String, Void, Bitmap>{

    TouchImageViewSubsampling imageView;

    CreatePage( TouchImageViewSubsampling temp){
        imageView = temp;
    }

    @Override
    protected Bitmap doInBackground(String... params) {
        final String pathRed = params[0];
        String path = params[1];
        String path2 = params[2];
        File Redu = new File(pathRed);
        if ( Redu.exists() )
        {
            if (imageView != null)
                ((Activity)ctx).runOnUiThread(new Runnable() {
                    public void run() {
                        imageView.setImageFile(pathRed);
                    }
                });
        } else {
            Bitmap bm1 = BitmapFactory.decodeFile(path);
            Bitmap bm2 = BitmapFactory.decodeFile(path2);
            ArrayList<Bitmap> a = new ArrayList<Bitmap>();
            a.add(bm1);
            a.add(bm2);
            Bitmap temp = combineImageIntoOne(a);
            FileOutputStream tempF = null;
            try {
                tempF = new FileOutputStream(Redu);
                temp.compress(Bitmap.CompressFormat.JPEG,100, tempF);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            if (imageView != null)
                ((Activity)ctx).runOnUiThread(new Runnable() {
                    public void run() {
                        imageView.setImageFile(pathRed);
                    }
                });
        }
        return null;
    }


}

Missing copyright statement

Hi!

I'd like to use your code for my commercial app but cannot find your copyright statement. :(
Can you add it?

Thanks,
EJ

force closed when zooming out

Hello
First of all, thanks for your great job.

I current have small problem that when zoom out using subsamplingscaleimageview

my app force closed with following error message.

18:51:46.613 dalvikvm E JNI ERROR (app bug): attempt to use stale local reference 0x8b90000d
18:51:46.613 dalvikvm D WAIT_FOR_CONCURRENT_GC blocked 46ms
18:51:46.623 dalvikvm E JNI ERROR (app bug): attempt to use stale local reference 0xdf80000d

which seems to related with JNI.

Do you have any clue on this?

Test phone is samsung galaxy frame (Android 4.1.2)

Drag and Drop markers

Hi there,

Is there an easy way to add onClick and onDrag/Drop events to overlayed items like pins?

I'm a beginner in Android development and I would try to do this by forking the project and taking a crak at it, but first I want to check if the feature is implemented, but I missed it.

Thank for your OSS contribution!

Typo in "Migrating to version 3"?

I see in your readme.md > Migrating to version 3:

view.setImageBitmap(map) -> view.getImage(ImageSource.bitmap(map))

Is it typo there? I think it should be view.setImage(ImageSource.bitmap(map)) instead.

Question: how to set a minimum bound so the image always fills the view?

Hi Dave,

First off thanks for the great library. I'm using a SubsamplingScaleImageView and I'm trying to configure it so that the image is never smaller than the containing view in either dimension - i.e. it can't be zoomed out to an extent that would show some letterboxing / whitespace surrounding it. Similar to the android ImageView's ScaleType.CENTER_CROP, but allowing for further zooming inwards. Before I go ahead and try and do this myself, just wanted to check if you had already built that into the library? I couldn't find anything in the source but wanted to save myself some work just in case 😃

Cheers
J

After double tapping, flinging doesn't work and it performs a click

First off, thanks for the awesome library!

Double tap to zoom in on a spot, and wait for the animation to end. Then if you try to fling, the fling doesn't work (translating stops immediately after you let your finger go) and sometimes it even reports that the view was clicked. This is annoying because when I use my app with one hand, I often double tap to zoom in and then fling. Instead it doesn't fling and performs a click that causes (in my app) the image to close.

I'm testing this on a Nexus 4.

abstract BitmapRegionDecoder so that other implementations can be used

Android's skia library is pretty problematic in many ways(certain PNG file fails, color profile are not respected on some JPGs, random segfaults, low res images.....), some implementations like RapidDecode falls back to external libraries such as libpng which solves all the problems.

Would it be possible to make BitmapRegionDecoder an interface and allow us to implement it?

Rotating the image in an arbitrary angle

Hi Dave, I've being using your code and its great

I was wondering how can I perform a rotation in an arbitrary angle (not a whole 90 degrees) with your code (similar to setRotation in View). If I try to rotate the view or the canvas - only the current tile ids rotated which doesn't help obviously

Michael

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.