{"action":"created","issue":{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/454","repository_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor","labels_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/454/labels{/name}","comments_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/454/comments","events_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/454/events","html_url":"https://github.com/JimBobSquarePants/ImageProcessor/issues/454","id":171643393,"number":454,"title":"Sporadic issue with encoder","user":{"login":"dwdickens","id":13432550,"avatar_url":"https://avatars.githubusercontent.com/u/13432550?v=3","gravatar_id":"","url":"https://api.github.com/users/dwdickens","html_url":"https://github.com/dwdickens","followers_url":"https://api.github.com/users/dwdickens/followers","following_url":"https://api.github.com/users/dwdickens/following{/other_user}","gists_url":"https://api.github.com/users/dwdickens/gists{/gist_id}","starred_url":"https://api.github.com/users/dwdickens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwdickens/subscriptions","organizations_url":"https://api.github.com/users/dwdickens/orgs","repos_url":"https://api.github.com/users/dwdickens/repos","events_url":"https://api.github.com/users/dwdickens/events{/privacy}","received_events_url":"https://api.github.com/users/dwdickens/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/labels/core","name":"core","color":"682079"},{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/labels/help%20needed","name":"help needed","color":"207de5"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-08-17T12:18:59Z","updated_at":"2016-08-18T13:47:52Z","closed_at":null,"body":"![works fine](https://cloud.githubusercontent.com/assets/13432550/17735920/558dae04-64c8-11e6-8dd7-2c9d7408208b.jpeg)\r\n\r\n![throws error](https://cloud.githubusercontent.com/assets/13432550/17735867/0b0d0c80-64c8-11e6-8ee6-02626d98913a.JPG)\r\nLoading an image file and then attempting to save it sometimes fails, depending on the picture. It makes no different whether manipulation is performed. First attached picture works. Second fails.\r\n\r\nI have added a tempStream to illustrate the problem. Certain pictures cause the following error: \tImageProcessorCore.ImageFormatException: Missing SOS marker.\r\n   at ImageProcessorCore.Formats.JpegDecoderCore.Decode[T,TP](Image`2 image, Stream stream, Boolean configOnly)\r\n\r\nAttempting to save the tempStream to a file results in an invalid jpeg, so I think the error is in the encoding not decoding.\r\n\r\nRunning ASP.NET core RTM\r\n\"ImageProcessorCore\": \"1.0.0-alpha-1009\"\r\n\r\nCode:\r\n\r\n      public abcde SaveUpload(IFormFile formFile)\r\n           {                                   \r\n            try\r\n            {               \r\n\r\n                string filePath = \"insert name and path.jpeg\";\r\n\r\n                using (MemoryStream stream = new MemoryStream())\r\n                using (MemoryStream tempStream = new MemoryStream())\r\n                using (FileStream output = File.OpenWrite(filePath))                \r\n                {\r\n\r\n                    ImageProcessorCore.Image image = new ImageProcessorCore.Image(formFile.OpenReadStream());\r\n\r\n                    image.SaveAsJpeg(tempStream, 75);\r\n\r\n                    ImageProcessorCore.Image testImage = new ImageProcessorCore.Image(tempStream); //throws error for certain images\r\n\r\n                    tempStream.WriteTo(output);\r\n\r\n                }\r\n\r\n      catch {...}\r\n      }"},"comment":{"url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/comments/240727933","html_url":"https://github.com/JimBobSquarePants/ImageProcessor/issues/454#issuecomment-240727933","issue_url":"https://api.github.com/repos/JimBobSquarePants/ImageProcessor/issues/454","id":240727933,"user":{"login":"JimBobSquarePants","id":385879,"avatar_url":"https://avatars.githubusercontent.com/u/385879?v=3","gravatar_id":"","url":"https://api.github.com/users/JimBobSquarePants","html_url":"https://github.com/JimBobSquarePants","followers_url":"https://api.github.com/users/JimBobSquarePants/followers","following_url":"https://api.github.com/users/JimBobSquarePants/following{/other_user}","gists_url":"https://api.github.com/users/JimBobSquarePants/gists{/gist_id}","starred_url":"https://api.github.com/users/JimBobSquarePants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JimBobSquarePants/subscriptions","organizations_url":"https://api.github.com/users/JimBobSquarePants/orgs","repos_url":"https://api.github.com/users/JimBobSquarePants/repos","events_url":"https://api.github.com/users/JimBobSquarePants/events{/privacy}","received_events_url":"https://api.github.com/users/JimBobSquarePants/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T13:47:52Z","updated_at":"2016-08-18T13:47:52Z","body":"JPEGsnoop output off image.\r\nThe failing one doesn't seem to get past the APP1 marker, Rational seems ok.\r\n\r\n```\r\nJPEGsnoop 1.7.3 by Calvin Hass\r\n  http://www.impulseadventure.com/photo/\r\n  -------------------------------------\r\n\r\n  Filename: [C:\\development\\github\\ImageProcessor\\tests\\ImageProcessorCore.Tests\\TestOutput\\Encode\\error.jpg]\r\n  Filesize: [2066987] Bytes\r\n\r\nStart Offset: 0x00000000\r\n*** Marker: SOI (xFFD8) ***\r\n  OFFSET: 0x00000000\r\n \r\n*** Marker: APP0 (xFFE0) ***\r\n  OFFSET: 0x00000002\r\n  Length     = 16\r\n  Identifier = [JFIF]\r\n  version    = [1.1]\r\n  density    = 0 x 96 DPI (dots per inch)\r\n  thumbnail  = 0 x 96\r\n \r\n*** Marker: APP1 (xFFE1) ***\r\n  OFFSET: 0x00000014\r\n  Length          = 49510\r\n  Identifier      = [Exif]\r\n  Identifier TIFF = 0x[49492A00 08000000]\r\n  Endian          = Intel (little)\r\n  TAG Mark x002A  = 0x002A\r\n\r\n  EXIF IFD0 @ Absolute 0x00000026\r\n    Dir Length = 0x000C\r\n    [ImageDescription                    ] = \"                               \"\r\n    [Make                                ] = \"SONY\"\r\n    [Model                               ] = \"DSC-WX80\"\r\n    [Orientation                         ] = 1 = Row 0: top, Col 0: left\r\n    [XResolution                         ] = 350/1\r\n    [YResolution                         ] = 350/1\r\n    [ResolutionUnit                      ] = Inch\r\n    [Software                            ] = \"DSC-WX80 v1.00\"\r\n    [DateTime                            ] = \"2013:08:05 15:47:31\"\r\n    [YCbCrPositioning                    ] = Co-sited\r\n    [ExifOffset                          ] = @ 0x011E\r\n    Offset to Next IFD = 0x00009742\r\n\r\n  EXIF IFD1 @ Absolute 0x00009760\r\n    Dir Length = 0x000D\r\n    [Compression                         ] = JPEG\r\n    [XResolution                         ] = 72/1\r\n    [YResolution                         ] = 72/1\r\n    [ResolutionUnit                      ] = Inch\r\n    [JpegIFOffset                        ] = @ +0x9848 = @ 0x9866\r\n    [JpegIFByteCount                     ] = 0x[00002918] / 10520\r\n    [YCbCrPositioning                    ] = Co-sited\r\n    Offset to Next IFD = 0x00000000\r\n\r\n  EXIF SubIFD @ Absolute 0x0000013C\r\n    Dir Length = 0x0024\r\n    [ExposureTime                        ] = 1/1600 s\r\n    [FNumber                             ] = F3.3\r\n    [ExposureProgram                     ] = Landscape mode\r\n    [ISOSpeedRatings                     ] = 100\r\n    [ExifVersion                         ] = 02.30\r\n    [DateTimeOriginal                    ] = \"2013:08:05 15:47:31\"\r\n    [DateTimeDigitized                   ] = \"2013:08:05 15:47:31\"\r\n    [ComponentsConfiguration             ] = [Y Cb Cr .]\r\n    [CompressedBitsPerPixel              ] = 3/1\r\n    [BrightnessValue                     ] = 25954/2560\r\n    [ExposureBiasValue                   ] = 0.00 eV\r\n    [MaxApertureValue                    ] = 882/256\r\n    [MeteringMode                        ] = Pattern\r\n    [LightSource                         ] = unknown\r\n    [Flash                               ] = Flash did not fire\r\n    [FocalLength                         ] = 5 mm\r\n    [MakerNote                           ] = @ 0x0334\r\n    [UserComment                         ] = \"\"\r\n    [FlashPixVersion                     ] = 01.00\r\n    [ColorSpace                          ] = sRGB\r\n    [ExifImageWidth                      ] = 0x[00001200] / 4608\r\n    [ExifImageHeight                     ] = 0x[00000D80] / 3456\r\n    [ExifInteroperabilityOffset          ] = @ 0x9724\r\n    [FileSource                          ] = DSC\r\n    [SceneType                           ] = A directly photographed image\r\n    [CustomRendered                      ] = Normal process\r\n    [ExposureMode                        ] = Auto exposure\r\n    [WhiteBalance                        ] = Auto white balance\r\n    [DigitalZoomRatio                    ] = 16/16\r\n    [SceneCaptureType                    ] = Landscape\r\n    [Contrast                            ] = 0\r\n    [Saturation                          ] = 0\r\n    [Sharpness                           ] = 0\r\n\r\n  EXIF MakerIFD @ Absolute 0x00000352\r\n    Makernote decode option not enabled.\r\n\r\n  EXIF InteropIFD @ Absolute 0x00009742\r\n    Dir Length = 0x0002\r\n    [InteroperabilityIndex               ] = \"R98\"\r\n    [InteroperabilityVersion             ] = 01.00\r\n \r\n*** Marker: EOI (End of Image) (xFFD9) ***\r\n  OFFSET: 0x0000C17C\r\n```\r\n\r\nSnoop of input image\r\n```\r\n\r\nJPEGsnoop 1.7.3 by Calvin Hass\r\n  http://www.impulseadventure.com/photo/\r\n  -------------------------------------\r\n\r\n  Filename: [C:\\development\\github\\ImageProcessor\\tests\\ImageProcessorCore.Tests\\TestImages\\Formats\\Jpg\\error.jpg]\r\n  Filesize: [6051468] Bytes\r\n\r\nStart Offset: 0x00000000\r\n*** Marker: SOI (xFFD8) ***\r\n  OFFSET: 0x00000000\r\n \r\n*** Marker: APP1 (xFFE1) ***\r\n  OFFSET: 0x00000002\r\n  Length          = 49512\r\n  Identifier      = [Exif]\r\n  Identifier TIFF = 0x[49492A00 08000000]\r\n  Endian          = Intel (little)\r\n  TAG Mark x002A  = 0x002A\r\n\r\n  EXIF IFD0 @ Absolute 0x00000014\r\n    Dir Length = 0x000C\r\n    [ImageDescription                    ] = \"                               \"\r\n    [Make                                ] = \"SONY\"\r\n    [Model                               ] = \"DSC-WX80\"\r\n    [Orientation                         ] = 1 = Row 0: top, Col 0: left\r\n    [XResolution                         ] = 350/1\r\n    [YResolution                         ] = 350/1\r\n    [ResolutionUnit                      ] = Inch\r\n    [Software                            ] = \"DSC-WX80 v1.00\"\r\n    [DateTime                            ] = \"2013:08:05 15:47:31\"\r\n    [YCbCrPositioning                    ] = Co-sited\r\n    [ExifOffset                          ] = @ 0x011E\r\n    Offset to Next IFD = 0x00009742\r\n\r\n  EXIF IFD1 @ Absolute 0x0000974E\r\n    Dir Length = 0x000D\r\n    [Compression                         ] = JPEG\r\n    [XResolution                         ] = 72/1\r\n    [YResolution                         ] = 72/1\r\n    [ResolutionUnit                      ] = Inch\r\n    [JpegIFOffset                        ] = @ +0x9848 = @ 0x9854\r\n    [JpegIFByteCount                     ] = 0x[00002918] / 10520\r\n    [YCbCrPositioning                    ] = Co-sited\r\n    Offset to Next IFD = 0x00000000\r\n\r\n  EXIF SubIFD @ Absolute 0x0000012A\r\n    Dir Length = 0x0024\r\n    [ExposureTime                        ] = 1/1600 s\r\n    [FNumber                             ] = F3.3\r\n    [ExposureProgram                     ] = Landscape mode\r\n    [ISOSpeedRatings                     ] = 100\r\n    [ExifVersion                         ] = 02.30\r\n    [DateTimeOriginal                    ] = \"2013:08:05 15:47:31\"\r\n    [DateTimeDigitized                   ] = \"2013:08:05 15:47:31\"\r\n    [ComponentsConfiguration             ] = [Y Cb Cr .]\r\n    [CompressedBitsPerPixel              ] = 3/1\r\n    [BrightnessValue                     ] = 25954/2560\r\n    [ExposureBiasValue                   ] = 0.00 eV\r\n    [MaxApertureValue                    ] = 882/256\r\n    [MeteringMode                        ] = Pattern\r\n    [LightSource                         ] = unknown\r\n    [Flash                               ] = Flash did not fire\r\n    [FocalLength                         ] = 5 mm\r\n    [MakerNote                           ] = @ 0x0334\r\n    [UserComment                         ] = \"\"\r\n    [FlashPixVersion                     ] = 01.00\r\n    [ColorSpace                          ] = sRGB\r\n    [ExifImageWidth                      ] = 0x[00001200] / 4608\r\n    [ExifImageHeight                     ] = 0x[00000D80] / 3456\r\n    [ExifInteroperabilityOffset          ] = @ 0x9724\r\n    [FileSource                          ] = DSC\r\n    [SceneType                           ] = A directly photographed image\r\n    [CustomRendered                      ] = Normal process\r\n    [ExposureMode                        ] = Auto exposure\r\n    [WhiteBalance                        ] = Auto white balance\r\n    [DigitalZoomRatio                    ] = 16/16\r\n    [SceneCaptureType                    ] = Landscape\r\n    [Contrast                            ] = 0\r\n    [Saturation                          ] = 0\r\n    [Sharpness                           ] = 0\r\n\r\n  EXIF MakerIFD @ Absolute 0x00000340\r\n    Makernote decode option not enabled.\r\n\r\n  EXIF InteropIFD @ Absolute 0x00009730\r\n    Dir Length = 0x0002\r\n    [InteroperabilityIndex               ] = \"R98\"\r\n    [InteroperabilityVersion             ] = 01.00\r\n \r\n*** Marker: APP2 (xFFE2) ***\r\n  OFFSET: 0x0000C16C\r\n  Length          = 146\r\n  Identifier      = [MPF]\r\n    Not supported. Skipping remainder.\r\n\r\n```"}}
{"actor":{"display_login":"JimBobSquarePants"}}