def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): if not haveImages: return pdfutils.cacheImageFile(image) #now we have one cached, slurp it in cachedname = os.path.splitext(image)[0] + (rl_config.useA85 and '.a85' or '.bin') imagedata = open(cachedname, 'rb').readlines() #trim off newlines... imagedata = list(map(str.strip, imagedata)) return imagedata
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): zlib = import_zlib() if not zlib: return if not haveImages: return pdfutils.cacheImageFile(image) #now we have one cached, slurp it in cachedname = os.path.splitext(image)[0] + '.a85' imagedata = open(cachedname, 'rb').readlines() #trim off newlines... imagedata = map(string.strip, imagedata) return imagedata
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): zlib = import_zlib() if not zlib: return if not haveImages: return pdfutils.cacheImageFile(image) #now we have one cached, slurp it in cachedname = os.path.splitext(image)[0] + (rl_config.useA85 and '.a85' or '.bin') imagedata = open(cachedname,'rb').readlines() #trim off newlines... imagedata = list(map(string.strip, imagedata)) return imagedata
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): zlib = import_zlib() if not zlib: return if not PIL_Image: return pdfutils.cacheImageFile(image) #now we have one cached, slurp it in cachedname = os.path.splitext(image)[0] + '.a85' imagedata = open(cachedname,'rb').readlines() #trim off newlines... imagedata = map(string.strip, imagedata) return imagedata
def cache_imagedata(self): image = self.image if not pdfutils.cachedImageExists(image): zlib = import_zlib() if not zlib: return if not haveImages: return pdfutils.cacheImageFile(image) #now we have one cached, slurp it in cachedname = os.path.splitext(image)[0] + (rl_config.useA85 and '.a85' or '.bin') imagedata = open(cachedname, 'rb').readlines() #trim off newlines... imagedata = [s.strip() for s in imagedata] return imagedata
def getImageData(self): "Gets data, height, width - whatever type of image" image = self.image (width, height) = self.dimensions if type(image) == StringType: self.filename = image if os.path.splitext(image)[1] in ['.jpg', '.JPG', '.jpeg', '.JPEG']: (imagedata, imgwidth, imgheight) = self.jpg_imagedata() else: if not self.imageCaching: imagedata = pdfutils.cacheImageFile(image,returnInMemory=1) else: imagedata = self.cache_imagedata() #parse line two for width, height words = string.split(imagedata[1]) imgwidth = string.atoi(words[1]) imgheight = string.atoi(words[3]) else: import sys if sys.platform[0:4] == 'java': #jython, PIL not available (imagedata, imgwidth, imgheight) = self.JAVA_imagedata() else: (imagedata, imgwidth, imgheight) = self.PIL_imagedata() #now build the PDF for the image. if not width: width = imgwidth if not height: height = imgheight self.width = width self.height = height self.imageData = imagedata
def getImageData(self,preserveAspectRatio=False): "Gets data, height, width - whatever type of image" image = self.image if type(image) == StringType: self.filename = image if os.path.splitext(image)[1] in ['.jpg', '.JPG', '.jpeg', '.JPEG']: (imagedata, imgwidth, imgheight) = self.jpg_imagedata() else: if not self.imageCaching: imagedata = pdfutils.cacheImageFile(image,returnInMemory=1) else: imagedata = self.cache_imagedata() words = string.split(imagedata[1]) imgwidth = string.atoi(words[1]) imgheight = string.atoi(words[3]) else: import sys if sys.platform[0:4] == 'java': #jython, PIL not available (imagedata, imgwidth, imgheight) = self.JAVA_imagedata() else: (imagedata, imgwidth, imgheight) = self.PIL_imagedata() self.imageData = imagedata self.imgwidth = imgwidth self.imgheight = imgheight self.width = self.width or imgwidth self.height = self.height or imgheight
def getImageData(self, preserveAspectRatio=False): "Gets data, height, width - whatever type of image" image = self.image if type(image) == StringType: self.filename = image if os.path.splitext(image)[1] in [ '.jpg', '.JPG', '.jpeg', '.JPEG' ]: (imagedata, imgwidth, imgheight) = self.jpg_imagedata() else: if not self.imageCaching: imagedata = pdfutils.cacheImageFile(image, returnInMemory=1) else: imagedata = self.cache_imagedata() words = string.split(imagedata[1]) imgwidth = string.atoi(words[1]) imgheight = string.atoi(words[3]) else: import sys if sys.platform[0:4] == 'java': #jython, PIL not available (imagedata, imgwidth, imgheight) = self.JAVA_imagedata() else: (imagedata, imgwidth, imgheight) = self.PIL_imagedata() self.imageData = imagedata self.imgwidth = imgwidth self.imgheight = imgheight self.width = self.width or imgwidth self.height = self.height or imgheight
def non_jpg_imagedata(self, image): if not self.imageCaching: imagedata = pdfutils.cacheImageFile(image, returnInMemory=1) else: imagedata = self.cache_imagedata() words = string.split(imagedata[1]) imgwidth = string.atoi(words[1]) imgheight = string.atoi(words[3]) return imagedata, imgwidth, imgheight
def non_jpg_imagedata(self,image): if not self.imageCaching: imagedata = pdfutils.cacheImageFile(image,returnInMemory=1) else: imagedata = self.cache_imagedata() words = string.split(imagedata[1]) imgwidth = string.atoi(words[1]) imgheight = string.atoi(words[3]) return imagedata, imgwidth, imgheight