当前位置: 首页>>代码示例>>Java>>正文


Java ImageIO.getImageReadersByFormatName方法代码示例

本文整理汇总了Java中javax.imageio.ImageIO.getImageReadersByFormatName方法的典型用法代码示例。如果您正苦于以下问题:Java ImageIO.getImageReadersByFormatName方法的具体用法?Java ImageIO.getImageReadersByFormatName怎么用?Java ImageIO.getImageReadersByFormatName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.imageio.ImageIO的用法示例。


在下文中一共展示了ImageIO.getImageReadersByFormatName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateOverviewFile

import javax.imageio.ImageIO; //导入方法依赖的package包/类
/**
 * Test method for {@link org.geoimage.viewer.widget.GeoOverviewToolbar#GeoOverviewToolbar()}.
 */
@Test
public void testCreateOverviewFile() {
	try{
		ImageIO.scanForPlugins();
		Object o=ImageIO.getImageReadersByFormatName("tiff");
		List<GeoImageReader> readers= GeoImageReaderFactory.createReaderForName(safe,PlatformConfiguration.getConfigurationInstance().getS1GeolocationAlgorithm());
		Sentinel1SLC slc=(Sentinel1SLC)(readers.get(0));
		
		Overview overview=new Overview(null);
		overview.setGir(slc);
		overview.buildOverview();
		
		assertTrue(true);
	}catch(Exception e){
		e.printStackTrace();
		assertTrue(false);
	}	
	
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:OverviewTest.java

示例2: cut

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static BufferedImage cut(String format, InputStream src, int x, int y, int w, int h) throws IOException {
	Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(format);
	ImageReader reader = (ImageReader) iterator.next();
	ImageInputStream iis = ImageIO.createImageInputStream(src);
	reader.setInput(iis, true);
	ImageReadParam param = reader.getDefaultReadParam();
	int imgWidth = reader.getWidth(0);
	int imgHeight = reader.getHeight(0);
	if (x + w > imgWidth) {
		w = imgWidth - x;
	}
	if (y + h > imgHeight) {
		h = imgHeight - y;
	}
	Rectangle rect = new Rectangle(x, y, w, h);
	param.setSourceRegion(rect);
	BufferedImage bi = reader.read(0, param);
	return bi;
}
 
开发者ID:szsucok,项目名称:sucok-framework,代码行数:20,代码来源:ImageSizeUtils.java

示例3: F2IR

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static ImageReader F2IR(String input) throws IOException {

		final File file = new File(input);

		// ��ȡͼƬ��ʽ
		final String formatname = GetPostfix.fromFilepath(input);

		Iterator<ImageReader> readers;
		ImageReader reader;
		ImageInputStream iis;
		readers = ImageIO.getImageReadersByFormatName(formatname);
		reader = readers.next();
		iis = ImageIO.createImageInputStream(file);
		reader.setInput(iis, false);

		return reader;
	}
 
开发者ID:zylo117,项目名称:SpotSpotter,代码行数:18,代码来源:File2ImageReader.java

示例4: newData

import javax.imageio.ImageIO; //导入方法依赖的package包/类
@Override
public void newData(byte[] bytes) {
	if(Dashboard.visionInitialized()){
		Mat m = CvProcessing.byteArray2Mat(bytes);
		Dashboard.setForVision(m);
	}
	if(mode == DisplayMode.Normal){
		ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
        Iterator<?> readers = ImageIO.getImageReadersByFormatName("jpeg");
 
        ImageReader reader = (ImageReader) readers.next();
        Object source = bis; 
       
		try {
			ImageInputStream iis = ImageIO.createImageInputStream(source); 
		    reader.setInput(iis, true);
		    ImageReadParam param = reader.getDefaultReadParam();
		    BufferedImage image = reader.read(0, param); 
		    setImage(image);
		} catch (IOException e) {
		}
	}

}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:25,代码来源:CameraViewer.java

示例5: TIFF

import javax.imageio.ImageIO; //导入方法依赖的package包/类
/**
    * 
    * @param imageFile
    * @param band form files with multiple band
    */
public TIFF(File imageFile,int band) {
   	this.imageFile=imageFile;
       try {
           Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("tiff");
           boolean worked=false;
           while(readers.hasNext()&&!worked){
           	Object obj=readers.next();
           	if( obj instanceof TIFFImageReader){
           		reader = (TIFFImageReader)obj;
           		iis=ImageIO.createImageInputStream(imageFile);
           		reader.setInput(iis);
           		try{
           			xSize=reader.getWidth(band);
           			ySize=reader.getHeight(band);
           			bounds=new Rectangle(0,0,xSize,ySize);
           		}catch(Exception e){
           			bounds=null;
           			logger.warn("Problem reading size information");
           		}	
           		worked=true;
           	}else{
           		
           	}
           }
           if(!worked){
           	logger.warn("No reader avalaible for this image");
           }
       } catch (Exception ex) {
       	logger.error(ex.getMessage(),ex);
       }	
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:37,代码来源:TIFF.java

示例6: read

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static BufferedImage read(String format, InputStream in) throws IOException {
	Iterator<ImageReader> iterator = ImageIO.getImageReadersByFormatName(format);
	ImageReader reader = (ImageReader) iterator.next();
	ImageInputStream iis = ImageIO.createImageInputStream(in);
	reader.setInput(iis, true);
	ImageReadParam param = reader.getDefaultReadParam();
	BufferedImage bi = reader.read(0, param);
	return bi;
}
 
开发者ID:szsucok,项目名称:sucok-framework,代码行数:10,代码来源:ImageUtils.java

示例7: IS2IR

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public static ImageReader IS2IR(ImageInputStream input, String formatname) throws IOException {

		Iterator<ImageReader> readers;
		ImageReader reader;
		readers = ImageIO.getImageReadersByFormatName(formatname);
		reader = readers.next();
		reader.setInput(input, false);

		return reader;
	}
 
开发者ID:zylo117,项目名称:SpotSpotter,代码行数:11,代码来源:ImageStream2ImageReader.java

示例8: beginDecoding

import javax.imageio.ImageIO; //导入方法依赖的package包/类
public void beginDecoding() {
    // Initialize the JPEG reader if needed.
    if(this.JPEGReader == null) {
        // Get all JPEG readers.
        Iterator<ImageReader> iter = ImageIO.getImageReadersByFormatName("jpeg");

        if(!iter.hasNext()) {
            throw new IllegalStateException("No JPEG readers found!");
        }

        // Initialize reader to the first one.
        this.JPEGReader = iter.next();

        this.JPEGParam = JPEGReader.getDefaultReadParam();
    }

    // Get the JPEGTables field.
    TIFFImageMetadata tmetadata = (TIFFImageMetadata)metadata;
    TIFFField f =
        tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_JPEG_TABLES);

    if (f != null) {
        this.hasJPEGTables = true;
        this.tables = f.getAsBytes();
    } else {
        this.hasJPEGTables = false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:TIFFJPEGDecompressor.java

示例9: testGetReaderFormatNames

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private static void testGetReaderFormatNames() {
    String[] names = ImageIO.getReaderFormatNames();
    for (String n : names) {
        Iterator<ImageReader> it = ImageIO.getImageReadersByFormatName(n);
        if (!it.hasNext()) {
            throw new RuntimeException("getReaderFormatNames returned " +
                                       "an unknown name: " + n);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:GetReaderWriterInfo.java

示例10: init

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private static void init() {

        Iterator i = ImageIO.getImageWritersByFormatName(format);
        if (!i.hasNext()) {
            throw new RuntimeException("No available ImageWrites for "+format+" format!");
        }
        iw = (ImageWriter)i.next();

        i = ImageIO.getImageReadersByFormatName(format);
        if (!i.hasNext()) {
            throw new RuntimeException("No available ImageReaders for " +format+" format!");
        }

        ir = (ImageReader)i.next();
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:WBMPPluginTest.java

示例11: testReaderIsRegistered

import javax.imageio.ImageIO; //导入方法依赖的package包/类
@Test
public void testReaderIsRegistered() {
  Supplier<Iterator<ImageReader>> getReaderIter = () -> ImageIO.getImageReadersBySuffix("jpg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
  getReaderIter = () -> ImageIO.getImageReadersByMIMEType("image/jpeg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
  getReaderIter = () -> ImageIO.getImageReadersByFormatName("jpeg");
  assertThat(getReaderIter.get()).isNotEmpty();
  assertThat(getReaderIter.get()).hasAtLeastOneElementOfType(TurboJpegImageReader.class);
}
 
开发者ID:dbmdz,项目名称:imageio-jnr,代码行数:13,代码来源:TurboJpegImageReaderTest.java

示例12: ImageLayer

import javax.imageio.ImageIO; //导入方法依赖的package包/类
/**
   *
   * @param gir
   */
  public ImageLayer(GeoImageReader gir) {
  	iReader=ImageIO.getImageReadersByFormatName("png");
pngReader=(ImageReader)iReader.next();

      this.activeGir = gir;
      poolSize = Integer.parseInt(ResourceBundle.getBundle("GeoImageViewer").getString("maxthreads"));
      //poolSize=Runtime.getRuntime().availableProcessors();
      //poolExcutorService = Executors.newFixedThreadPool(poolSize);
      poolExcutorService = new ThreadPoolExecutor(1,poolSize,100, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>());//,new ThreadPoolExecutor.DiscardOldestPolicy());


      submitedTiles = new ArrayList<String>();

      setName(gir);

      activeBand = 0;
      levels = (int) (Math.sqrt(Math.max(gir.getWidth() / Constant.TILE_SIZE_DOUBLE, gir.getHeight() / Constant.TILE_SIZE_DOUBLE))) + 1;
      maxlevels = (int) (Math.sqrt(Math.max(gir.getWidth() / (Constant.TILE_SIZE_DOUBLE*2), gir.getHeight() / (Constant.TILE_SIZE_DOUBLE*2)))) +1;  //massimo livello di zoom
      curlevel = levels;

      //TODO Understand the meaning of this values for padding
      xpadding = (((1 << levels) << 8) - gir.getWidth()) / 2;  // is equal to(int)((Math.pow(2,levels+8)- gir.getWidth())/2);
      ypadding = (((1 << levels) << 8) - gir.getHeight()) / 2; //			   (int)((Math.pow(2,levels+8)- gir.getHeight())/2);

      String temp = SumoPlatform.getApplication().getConfiguration().getMaxTileBuffer();
      int maxBuffer = Integer.parseInt(temp);
      tcm = new TextureCacheManager(maxBuffer);
      setInitialContrast();
      maxnumberoftiles = SumoPlatform.getApplication().getConfiguration().getMaxNumOfTiles();
      createMatrixTileOrder();

      int tileSize = (int)(Constant.TILESIZE / gir.getPixelsize()[0]);
      if(tileSize < Constant.TILESIZEPIXELS) tileSize = Constant.TILESIZEPIXELS;

      this.horizontalTilesImage = gir.getWidth() / tileSize;
      this.verticalTilesImage= gir.getHeight()/ tileSize;

   // the real size of tiles
      this.realTileSizeX = gir.getWidth() / horizontalTilesImage;
      this.realTileSizeY = gir.getHeight() / verticalTilesImage;


  }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:48,代码来源:ImageLayer.java

示例13: getImageReader

import javax.imageio.ImageIO; //导入方法依赖的package包/类
private ImageReader getImageReader(final String imgType) {
	// 建立图片读取器
	Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imgType);
	return readers.next();
}
 
开发者ID:wooui,项目名称:springboot-training,代码行数:6,代码来源:ImageUtil.java


注:本文中的javax.imageio.ImageIO.getImageReadersByFormatName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。