def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if filename.endswith(".jpg"): xm = None else: upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "Thumbnail")): os.makedirs(os.path.join(upperDir, "Thumbnail"), int("775", 8)) destinationPath = os.path.join(upperDir, "Thumbnail") xsd = XSDataInputExecThumbnail() xsdFile = XSDataFile() xsdFile.setPath(XSDataString(filename)) xsd.setInputImagePath(xsdFile) xsdPath = XSDataFile() xsdPath.setPath(XSDataString(destinationPath)) xsd.setOutputPath(xsdPath) xsd.setLevelsColorize(XSDataBoolean(True)) xsd.setLevelsNormalize(XSDataBoolean(True)) xsd.setLevelsGamma(XSDataFloat(gamma)) xml = xsd.marshal() return xml
def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if filename.endswith(".jpg"): xm = None else: upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "Thumbnail")): os.makedirs(os.path.join(upperDir, "Thumbnail"), int("775", 8)) destinationPath = os.path.join(upperDir, "Thumbnail") xsd = XSDataInputExecThumbnail() xsdFile = XSDataFile() xsdFile.setPath(XSDataString(filename)) xsd.setInputImagePath(xsdFile) xsdPath = XSDataFile() xsdPath.setPath(XSDataString(destinationPath)) xsd.setOutputPath(xsdPath) # xsd.setLevelsColorize(XSDataBoolean(True)) # xsd.setLevelsNormalize(XSDataBoolean(True)) xsd.setLevelsEqualize(XSDataBoolean(True)) # xsd.setLevelsGamma(XSDataDouble(gamma)) xsd.setLevelsMin(XSDataDouble(0.0)) xsdMax = XSDataDoubleWithUnit() xsdMax.setValue(99.9) xsdMax.setUnit(XSDataString("""%""")) xsd.setLevelsMax(xsdMax) # xsd.setLevelsAutoContrast(XSDataDouble(1.0)) xsd.setFilterBlur([XSDataInteger(5)]) xsd.setFilterDilatation([XSDataInteger(10)]) #xsd.setCropBorders(XSDataInteger(), XSDataInteger()) xsd.setLevelsInvert(XSDataBoolean(True)) xsd.setThumbHeight(XSDataInteger(256)) xsd.setThumbWidth(XSDataInteger(256)) xml = xsd.marshal() return xml
def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if filename.endswith(".jpg"): xm = None else: upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "Thumbnail")): os.makedirs(os.path.join(upperDir, "Thumbnail"), int("775", 8)) destinationPath = os.path.join(upperDir, "Thumbnail") xsd = XSDataInputExecThumbnail() xsdFile = XSDataFile() xsdFile.setPath(XSDataString(filename)) xsd.setInputImagePath(xsdFile) xsdPath = XSDataFile() xsdPath.setPath(XSDataString(destinationPath)) xsd.setOutputPath(xsdPath) # xsd.setLevelsColorize(XSDataBoolean(True)) # xsd.setLevelsNormalize(XSDataBoolean(True)) xsd.setLevelsEqualize(XSDataBoolean(True)) # xsd.setLevelsGamma(XSDataDouble(gamma)) xsd.setLevelsMin(XSDataDouble(0.0)) xsdMax = XSDataDoubleWithUnit() xsdMax.setValue(99.9) xsdMax.setUnit(XSDataString("""%""")) xsd.setLevelsMax(xsdMax) # xsd.setLevelsAutoContrast(XSDataDouble(1.0)) xsd.setFilterBlur([XSDataInteger(5)]) xsd.setFilterDilatation([XSDataInteger(10)]) # xsd.setCropBorders(XSDataInteger(), XSDataInteger()) xsd.setLevelsInvert(XSDataBoolean(True)) xsd.setThumbHeight(XSDataInteger(256)) xsd.setThumbWidth(XSDataInteger(256)) xml = xsd.marshal() return xml