001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.imaging;
018
019/**
020 * Enumerates known image formats.
021 */
022public enum ImageFormats implements ImageFormat {
023
024    // @formatter:off
025    UNKNOWN(),
026    BMP("bmp", "dib"),
027    DCX("dcx"),
028    GIF("gif"),
029    ICNS("icns"),
030    ICO("ico"),
031    JBIG2(),
032    JPEG("jpg", "jpeg"),
033    PAM("pam"),
034    PSD("psd"),
035    PBM("pbm"),
036    PGM("pgm"),
037    PNM("pnm"),
038    PPM("ppm"),
039    PCX("pcx", "pcc"),
040    PNG("png"),
041    RGBE("hdr", "pic"),
042    TGA(),
043    TIFF("tif", "tiff"),
044    WBMP("wbmp"),
045    WEBP("webp"),
046    XBM("xbm"),
047    XPM("xpm");
048    // @formatter:on
049
050    private final String[] extensions;
051
052    ImageFormats(final String... extensions) {
053        this.extensions = extensions;
054    }
055
056    @Override
057    public String getDefaultExtension() {
058        return this.extensions != null ? this.extensions[0] : null;
059    }
060
061    @Override
062    public String[] getExtensions() {
063        return this.extensions.clone();
064    }
065
066    @Override
067    public String getName() {
068        return name();
069    }
070}