{"action":"created","issue":{"url":"https://api.github.com/repos/bumptech/glide/issues/1272","repository_url":"https://api.github.com/repos/bumptech/glide","labels_url":"https://api.github.com/repos/bumptech/glide/issues/1272/labels{/name}","comments_url":"https://api.github.com/repos/bumptech/glide/issues/1272/comments","events_url":"https://api.github.com/repos/bumptech/glide/issues/1272/events","html_url":"https://github.com/bumptech/glide/issues/1272","id":160993991,"number":1272,"title":"using .thumbnail() with .transcode()","user":{"login":"LorneLaliberte","id":700370,"avatar_url":"https://avatars.githubusercontent.com/u/700370?v=3","gravatar_id":"","url":"https://api.github.com/users/LorneLaliberte","html_url":"https://github.com/LorneLaliberte","followers_url":"https://api.github.com/users/LorneLaliberte/followers","following_url":"https://api.github.com/users/LorneLaliberte/following{/other_user}","gists_url":"https://api.github.com/users/LorneLaliberte/gists{/gist_id}","starred_url":"https://api.github.com/users/LorneLaliberte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorneLaliberte/subscriptions","organizations_url":"https://api.github.com/users/LorneLaliberte/orgs","repos_url":"https://api.github.com/users/LorneLaliberte/repos","events_url":"https://api.github.com/users/LorneLaliberte/events{/privacy}","received_events_url":"https://api.github.com/users/LorneLaliberte/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bumptech/glide/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-06-17T23:42:50Z","updated_at":"2016-07-13T10:31:08Z","closed_at":"2016-07-08T14:03:58Z","body":"<!-- What version of Glide you're running, for example: 3.7.1 | 3.8.0-SNAPSHOT | 4.0.0-SNAPSHOT\r\nIt's essentially the version number from your build.gradle: `dependencies { compile '...:x.y.z' }` -->\r\n**Glide Version**: 3.8.0-SNAPSHOT\r\n\r\n<!-- What devices you managed to get the issue to come up on? For example:\r\nfails on Galaxy S4/GT-I9500 4.4.2, works fine on Nexus 6P 5.1 and Genymotion Nexus 5 5.0.1 -->\r\n**Device/Android Version**: Nexus 5, 5.0.1\r\n\r\nI'm using a `PaletteBitmapTranscoder` to generate a palette, as demonstrated in the [Custom targets](https://github.com/bumptech/glide/wiki/Custom-targets#palette-example) section of the Glide wiki.\r\n\r\nHowever, when using `.thumbnail()` in cases where the thumbnail request finishes after the full request, it ends up using the palette that was generated for the thumbnail instead of the full image.\r\n\r\nSince `Palette` generates very different color swatches as an image is resized, this can affect the results.\r\n\r\nIn my test, the thumbnail palette always gets used the first time the image is loaded, but the full image's palette is used for all subsequent loads. (I think that if the full request is in the cache, the thumbnail does not get generated?)\r\n\r\nIs there a way to prevent transcoding of the thumbnail when using a transcoder for the full image request?\r\n\r\nI've tried changing the order of where `.thumbnail()` is called when building the request, but didn't have any luck with that approach. Most of those attempts wouldn't compile because of type incompatibility, e.g. not having a compatible `TranscodeType` with the full request.\r\n\r\nI also tried using an explicit thumbnail request with its own settings but that didn't work; the full request's resource transcoder still gets called for the thumbnail. Giving the thumbnail its own `PalletteBitmapNullTranscoder` that doesn't generate a palette didn't work either; it just resulted in additional `transcode()` calls (and additional `DecodeJobs` in the log output). The additional `transcode()` calls did what I wanted (namely, not generating a palette) but it didn't replace the original thumbnail `transcode()` call that I was trying to override.\r\n\r\nAt this point I've disabled thumbnail generation when using a PaletteBitmapTranscoder, but I'm still new to Glide so I wonder if there might be something obvious that I might be missing.\r\n\r\nFor instance, is there any way to create a thumbnail request that uses a different `TranscodeType`, or a different `ModelType` for that matter?\r\n\r\nOr is there some way within a `ResourceTranscoder` to know whether `transcode()` is being called for the full request or the thumbnail request?\r\n"},"comment":{"url":"https://api.github.com/repos/bumptech/glide/issues/comments/232318174","html_url":"https://github.com/bumptech/glide/issues/1272#issuecomment-232318174","issue_url":"https://api.github.com/repos/bumptech/glide/issues/1272","id":232318174,"user":{"login":"TWiStErRob","id":2906988,"avatar_url":"https://avatars.githubusercontent.com/u/2906988?v=3","gravatar_id":"","url":"https://api.github.com/users/TWiStErRob","html_url":"https://github.com/TWiStErRob","followers_url":"https://api.github.com/users/TWiStErRob/followers","following_url":"https://api.github.com/users/TWiStErRob/following{/other_user}","gists_url":"https://api.github.com/users/TWiStErRob/gists{/gist_id}","starred_url":"https://api.github.com/users/TWiStErRob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWiStErRob/subscriptions","organizations_url":"https://api.github.com/users/TWiStErRob/orgs","repos_url":"https://api.github.com/users/TWiStErRob/repos","events_url":"https://api.github.com/users/TWiStErRob/events{/privacy}","received_events_url":"https://api.github.com/users/TWiStErRob/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T10:31:08Z","updated_at":"2016-07-13T10:31:08Z","body":"> getting generated for a bitmap that was retrieved from the RESULT cache\r\n\r\nAh, I see what you mean now, you wording confused me. The image is always decoded from SOURCE cache, but then it is transformed to target size. This transformed version is written to RESULT along with palette. \r\n\r\n>  already caused the bitmap to be cached at the RESULT size, without generating a palette\r\n\r\nAgain, key includes encoder's ID, so if it was cached without palette it cannot be read by the palette cache decoder (except when you play some tricks with getId).\r\n\r\n> My original question was related to how the \"Inclusive\" example would not end up generating a palette for the RESULT bitmap\r\n\r\nOk, that's true. The inclusive version has the issue of slightly varying palette. But it's emphasized if you run it, and included in the class comment. I created that to double-check and someone finding it may not be that bothered about it.\r\n\r\n---\r\n\r\nIf you can share, I would be curious to see the end result (app)."}}
{"actor":{"display_login":"TWiStErRob"}}