<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JPEG to JPEG2000 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589439#M46186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ryan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't appear that PIL support JPEG2000 as you mentioned.&amp;nbsp; You'll notice that if you right-click on the .jp2 in ArcCatalog &amp;gt; Properties the Compression type is still JPEG rather than JPG2000.&amp;nbsp; It appears this module better compresses imagery than ArcGIS, explaining while the new file is smaller in size.&amp;nbsp; I would keep the extension .jpg (rather than .jp2) and see if you still receive the error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Dec 2011 17:29:43 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2011-12-28T17:29:43Z</dc:date>
    <item>
      <title>JPEG to JPEG2000</title>
      <link>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589438#M46185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using PIL to convert .jpg's to .jp2's (for cache) for our mobile devices. I have not seen anything that says PIL supports JPEG2000... however, my script seems to work... the file sizes are smaller, and they show up more clear on the mobile devices (using ArcPad).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue is that only some of the cache scales are viewed without error on the mobile device, and I am wondering if I can use the code the way I am, or if I am essentially running into issues since PIL does not "support"&amp;nbsp; JPEG2000.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any experience with this? Is there a better way to convert to .jp2, preferably with Python? Too bad you can't create your cache directly to .jp2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import Image, os, sys
rootPath = myPath
for (path, dirs, files) in os.walk(rootPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for file in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if file.lower().endswith(".jpg"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jpgName = file.replace(".jpg","")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jpg = Image.open(path + "\\" + file)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jpg.save(path + "\\" + jpgName + ".jp2", "JPEG")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2011 14:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589438#M46185</guid>
      <dc:creator>RyanKelley</dc:creator>
      <dc:date>2011-12-28T14:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: JPEG to JPEG2000</title>
      <link>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589439#M46186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ryan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't appear that PIL support JPEG2000 as you mentioned.&amp;nbsp; You'll notice that if you right-click on the .jp2 in ArcCatalog &amp;gt; Properties the Compression type is still JPEG rather than JPG2000.&amp;nbsp; It appears this module better compresses imagery than ArcGIS, explaining while the new file is smaller in size.&amp;nbsp; I would keep the extension .jpg (rather than .jp2) and see if you still receive the error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2011 17:29:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589439#M46186</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-12-28T17:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: JPEG to JPEG2000</title>
      <link>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589440#M46187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the tip... and yes, they still are smaller just keeping them as .jpg (they are the ame size as the .jp2's would be). So, I'll have the mobile folks test this out and see how it goes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2011 18:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/jpeg-to-jpeg2000/m-p/589440#M46187</guid>
      <dc:creator>RyanKelley</dc:creator>
      <dc:date>2011-12-28T18:15:45Z</dc:date>
    </item>
  </channel>
</rss>

