{"action":"created","issue":{"url":"https://api.github.com/repos/tinify/tinify-net/issues/13","repository_url":"https://api.github.com/repos/tinify/tinify-net","labels_url":"https://api.github.com/repos/tinify/tinify-net/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/tinify/tinify-net/issues/13/comments","events_url":"https://api.github.com/repos/tinify/tinify-net/issues/13/events","html_url":"https://github.com/tinify/tinify-net/issues/13","id":281514733,"number":13,"title":"\"CompressionCount\" being double charged?","user":{"login":"ChrisInSeattle","id":7756784,"avatar_url":"https://avatars2.githubusercontent.com/u/7756784?v=4","gravatar_id":"","url":"https://api.github.com/users/ChrisInSeattle","html_url":"https://github.com/ChrisInSeattle","followers_url":"https://api.github.com/users/ChrisInSeattle/followers","following_url":"https://api.github.com/users/ChrisInSeattle/following{/other_user}","gists_url":"https://api.github.com/users/ChrisInSeattle/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisInSeattle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisInSeattle/subscriptions","organizations_url":"https://api.github.com/users/ChrisInSeattle/orgs","repos_url":"https://api.github.com/users/ChrisInSeattle/repos","events_url":"https://api.github.com/users/ChrisInSeattle/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisInSeattle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-12T19:48:49Z","updated_at":"2017-12-15T13:32:45Z","closed_at":null,"author_association":"NONE","body":"I have the following code:\r\n`public async Task<byte[]> CompressImageFromUrlAsync(string url)\r\n        {\r\n            var a1 = Tinify.CompressionCount;\r\n            var source =\r\n                await Tinify.FromUrl(url).ConfigureAwait(false); // <- CompressionCount inc here \r\n            var a2 = Tinify.CompressionCount;\r\n            var copyrighted = source.Preserve(\"copyright\");\r\n            var a3 = Tinify.CompressionCount;\r\n            var outputBuffer = await copyrighted.ToBuffer().ConfigureAwait(false); // <- CompressionCount inc here \r\n            var a4 = Tinify.CompressionCount;\r\n\r\n            Debug.WriteLine($\"CompressImageFromUrl checkpoints: {a1}, {a2}, {a3}, {a4}\");\r\n\r\n            return outputBuffer;\r\n        }`\r\n\r\nIt looks like my CompressionCount is being double charged. It's incremented in both the FromUrl() call and the ToBuffer() call. Unless I'm missing something.. ?"},"comment":{"url":"https://api.github.com/repos/tinify/tinify-net/issues/comments/352006554","html_url":"https://github.com/tinify/tinify-net/issues/13#issuecomment-352006554","issue_url":"https://api.github.com/repos/tinify/tinify-net/issues/13","id":352006554,"user":{"login":"tinify-support","id":22392384,"avatar_url":"https://avatars3.githubusercontent.com/u/22392384?v=4","gravatar_id":"","url":"https://api.github.com/users/tinify-support","html_url":"https://github.com/tinify-support","followers_url":"https://api.github.com/users/tinify-support/followers","following_url":"https://api.github.com/users/tinify-support/following{/other_user}","gists_url":"https://api.github.com/users/tinify-support/gists{/gist_id}","starred_url":"https://api.github.com/users/tinify-support/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinify-support/subscriptions","organizations_url":"https://api.github.com/users/tinify-support/orgs","repos_url":"https://api.github.com/users/tinify-support/repos","events_url":"https://api.github.com/users/tinify-support/events{/privacy}","received_events_url":"https://api.github.com/users/tinify-support/received_events","type":"User","site_admin":false},"created_at":"2017-12-15T13:32:44Z","updated_at":"2017-12-15T13:32:44Z","author_association":"NONE","body":"Hi,\n\nThanks for contacting us. After some testing it seems that\nchanging the metadata (i.e. keeping it) increments the count\nvalue. We will look into this but in the meantime can you please\nsend us your TinyPNG email so that we credit your account for the\nextra incurred compressions.\n\nLooking forward to hearing from you.\n\nKind regards,\n\nEvert Rotshuizen\n\nWe are always looking for ways to improve our products. Click\nhere ( https://insights.hotjar.com/s?siteId=648131&surveyId=28591 )  to give us your opinion (it will take less than 1 minute).\n\ntinify/tinify-net on December 12, 2017 at 8:48pm wrote:\n\nI have the following code:\n\n`public async Task<byte[]> CompressImageFromUrlAsync(string url)\n\n{\n\nvar a1 = Tinify.CompressionCount;\n\nvar source =\n\nawait Tinify.FromUrl(url).ConfigureAwait(false); // <-\nCompressionCount inc here\n\nvar a2 = Tinify.CompressionCount;\n\nvar copyrighted = source.Preserve(\"copyright\");\n\nvar a3 = Tinify.CompressionCount;\n\nvar outputBuffer = await\ncopyrighted.ToBuffer().ConfigureAwait(false); // <-\nCompressionCount inc here\n\nvar a4 = Tinify.CompressionCount;\n\nDebug.WriteLine($\"CompressImageFromUrl checkpoints: {a1}, {a2},\n{a3}, {a4}\");\n\nreturn outputBuffer;\n}`\n\nIt looks like my CompressionCount is being double charged. It's\nincremented in both the FromUrl() call and the ToBuffer() call.\nUnless I'm missing something.. ?\n\n—\nYou are receiving this because you are subscribed to this thread.\nReply to this email directly, view it on GitHub \n( https://github.com/tinify/tinify-net/issues/13 ), or mute the\nthread \n( https://github.com/notifications/unsubscribe-auth/AVWuQKPVFrWWE02Ow4szEwaZeRP0j3TWks5s_tihgaJpZM4Q_iPZ )\n."}}
{"actor":{"display_login":"tinify-support"}}