Convert jpg to tif - arcpy

9556
27
Jump to solution
03-30-2015 07:39 AM
Yaron_YosefCohen
Occasional Contributor II

Hi

I have several rasters( jpg files ) and i want convert them to tif files to file " OtherFormat" in env.workspace with arcpy. In my code i try to convert all jpg file:

import arcpy,os,sys,string
import arcpy.mapping
from arcpy import env

env.workspace = r"C:\Project\out"
arcpy.RasterToOtherFormat_conversion("*.jpg","OtherFormat","TIFF") 
print 'converted'

but get en error:

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rasters: Dataset *.jpg does not exist or is not supported
Failed to execute (RasterToOtherFormat).

any help would be great

Tags (2)
0 Kudos
27 Replies
Yaron_YosefCohen
Occasional Contributor II

Hi Xander,

i run the code with this changes :

in_folder = r"C:\Project\out"  
out_folder = r"C:\Project\out\jpg"

and the result:

>>> 
[u'BSM-1534.tif']
BSM-1534.tif
>>>

and no converted rasters in the out folder. I don't know why the code don't convert- it seems right and clear

0 Kudos
Yaron_YosefCohen
Occasional Contributor II

Hi Xander,

i don't know why it's wrong. i get result:

>>>

[u'BSM-1534.tif']

BSM-1534.tif

>>>

and the raster didn't converted

0 Kudos
XanderBakker
Esri Esteemed Contributor

I have no idea... the code worked for me on my sample data.

Maybe you can attach the mentioned TIF so I can see what it's like?

0 Kudos
Yaron_YosefCohen
Occasional Contributor II

the tif raster size is more than 500 mega.how can i send it and to which email?

by the way, i succeed convert jpg to tif but when i try tif2jpg it don't work.

and more important to me to convert ecw to jpg. in ArcGIS Help (10.2, 10.2.1, and 10.2.2)

i don't see any mention to ecw file

0 Kudos
DanPatterson_Retired
MVP Emeritus

Try it with a smaller size tif to see if it image size (which I suspect, or a corrupt tif)

Convert the ecw to another format in the originating software if you have it

Yaron_YosefCohen
Occasional Contributor II

you right!!  i tried with smaller  size tif raster and tif2jpg succeed.

but when i tried  ecw2tif the python stop working. could you know way?

0 Kudos
Yaron_YosefCohen
Occasional Contributor II

i don't have originating software. can you recommend one please?

0 Kudos
DanPatterson_Retired
MVP Emeritus

google " ecw to tif "  there are purportedly free converters and trial versions online if ArcMap doesn't support ecw

0 Kudos