diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,3 +11,7 @@
 ## 0.1.2.1 -- 2020-05-20
 
 * Fix overflow of parsing number
+
+## 0.1.2.2 -- 2020-05-22
+
+* Support for OSC1337
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -17,9 +17,19 @@
 
 ![demo](https://raw.githubusercontent.com/junjihashimoto/sixel/master/demo.png)
 
+# Terminal requirements
 
+For using sixel, see terminal requirements of [libsixel](https://saitoha.github.io/libsixel).
+
+This library supports OSC-1337, too.
+OSC-1337 is available for iterm2 and [hterm of crostini](https://chromium.googlesource.com/apps/libapps/+/master/hterm).
+
+![demo](https://raw.githubusercontent.com/junjihashimoto/sixel/master/demo-osc1337.png)
+
 # References
 
 * https://en.wikipedia.org/wiki/Sixel
 * https://saitoha.github.io/libsixel
+* https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ControlSequences.md#OSC-1337
+* https://www.iterm2.com/documentation-escape-codes.html
 
diff --git a/demo-osc1337.png b/demo-osc1337.png
new file mode 100644
Binary files /dev/null and b/demo-osc1337.png differ
diff --git a/sixel.cabal b/sixel.cabal
--- a/sixel.cabal
+++ b/sixel.cabal
@@ -1,6 +1,6 @@
 cabal-version:       >=1.10
 name:                sixel
-version:             0.1.2.1
+version:             0.1.2.2
 synopsis:            Sixel library to show images in a terminal emulator
 description:         Sixel can show graphics on a terminal emulator. This library is developed to showing images on ghci.
 license:             BSD3
@@ -13,10 +13,13 @@
 build-type:          Simple
 extra-source-files:  CHANGELOG.md
                    , demo.png
+                   , demo-osc1337.png
                    , README.md
 
 library
   exposed-modules:     Data.Sixel
+                     , Data.Sixel.Internal
+                     , Data.OSC1337
   hs-source-dirs:      src
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
@@ -25,6 +28,7 @@
                      , bytestring
                      , process
                      , temporary
+                     , base64-bytestring
   c-sources:           csrc/sixel.c
 
 executable sixel-exe
diff --git a/src/Data/OSC1337.hs b/src/Data/OSC1337.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/OSC1337.hs
@@ -0,0 +1,105 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Data.OSC1337
+  ( module Data.OSC1337,
+    LatexStr (..),
+    latex,
+    math,
+  )
+where
+
+import Codec.Picture
+import Codec.Picture.Png (encodePng)
+import qualified Data.ByteString as B
+import Data.ByteString (ByteString)
+import Data.ByteString.Base64 (encode)
+import qualified Data.ByteString.Char8 as BC
+import Data.ByteString.Lazy (toStrict)
+import Data.Sixel.Internal
+import System.IO.Unsafe (unsafePerformIO)
+
+data OSCCmd
+  = Start
+  | End
+  | FileName String
+  | Size Int
+  | Width Int
+  | Height Int
+  | PreserveAspectRatio Int
+  | Inline Int
+  | Align String
+  | MimeType String
+  | ImageDat String
+  deriving (Eq)
+
+instance Show OSCCmd where
+  show = \case
+    Start -> "\ESC]1337;"
+    End -> "\a"
+    Size s -> "size=" ++ show s ++ ";"
+    Width s -> "width=" ++ show s ++ ";"
+    Height s -> "height=" ++ show s ++ ";"
+    PreserveAspectRatio s -> "preserveAspectRatio=" ++ show s ++ ";"
+    Inline s -> "inline=" ++ show s ++ ";"
+    Align s -> "align=" ++ s ++ ";"
+    MimeType s -> "type=" ++ s ++ ";"
+    ImageDat s -> BC.unpack $ encode $ BC.pack s
+
+instance {-# OVERLAPS #-} Show [OSCCmd] where
+  show xs = concat $ map show xs
+
+newtype OSCImage = OSCImage {toOSCString :: String} deriving (Eq)
+
+instance Show OSCImage where
+  show (OSCImage img) = img
+
+-- | See https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ControlSequences.md#OSC-1337
+class ToOSC a where
+  toOSC :: a -> OSCImage
+  putOSC :: a -> IO ()
+
+instance {-# OVERLAPS #-} (Show a) => ToOSC a where
+  toOSC xs = OSCImage $ show xs
+  putOSC xs = putStrLn $ show xs
+
+img2osc :: Image PixelRGB8 -> ByteString
+img2osc img =
+  let (Image w h _) = img
+      dat = toStrict $ encodePng img
+   in B.concat
+        [ "\ESC]1337;File=name=",
+          encode "display.png",
+          ";",
+          "width=" <> BC.pack (show w) <> "px;",
+          "height=" <> BC.pack (show h) <> "px;",
+          "inline=1;:",
+          encode dat,
+          "\a"
+        ]
+
+instance {-# OVERLAPS #-} ToOSC DynamicImage where
+  toOSC dimg = toOSC $ convertRGB8 dimg
+  putOSC img = putOSC $ convertRGB8 img
+
+instance {-# OVERLAPS #-} ToOSC (Image PixelRGB8) where
+  toOSC img = OSCImage (BC.unpack $ img2osc img)
+  putOSC img = B.putStr $ img2osc img
+
+putImage :: FilePath -> IO ()
+putImage file = do
+  readImage file >>= \case
+    Left err -> print err
+    Right img -> putOSC img
+
+instance Show LatexStr where
+  show str = show $ toOSC str
+
+instance ToOSC LatexStr where
+  toOSC str = unsafePerformIO $ do
+    latex2img str >>= \case
+      Left err -> error err
+      Right img -> return $ toOSC img
+  putOSC img = putStr $ show $ toOSC img
diff --git a/src/Data/Sixel.hs b/src/Data/Sixel.hs
--- a/src/Data/Sixel.hs
+++ b/src/Data/Sixel.hs
@@ -1,14 +1,21 @@
 {-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE UndecidableInstances #-}
 {-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE UndecidableInstances #-}
 
-module Data.Sixel where
+module Data.Sixel
+  ( module Data.Sixel,
+    LatexStr (..),
+    latex,
+    math,
+  )
+where
 
 import Codec.Picture
 import Data.ByteString (ByteString)
 import qualified Data.ByteString.Char8 as BC
 import qualified Data.ByteString.Internal as B
 import Data.Char (chr)
+import Data.Sixel.Internal
 import qualified Data.Vector.Storable as V
 import Data.Word (Word8)
 import Foreign.C.String
@@ -19,25 +26,8 @@
 import System.IO.Unsafe (unsafePerformIO)
 import System.Process (readProcessWithExitCode)
 
-foreign import ccall "bufsize" c_bufsize :: CInt -> CInt -> IO CInt
-
-foreign import ccall "img2sixel" c_img2sixel :: Ptr () -> Ptr () -> CInt -> CInt -> IO CInt
-
 newtype SixelImage = SixelImage {toSixelString :: String} deriving (Eq)
 
-data LatexStr
-  = LatexStr
-      { toLatexStr :: String,
-        strSize :: Float
-      }
-  deriving (Eq)
-
-latex :: String -> LatexStr
-latex str = LatexStr str 2.5
-
-math :: String -> LatexStr
-math str = LatexStr ("$"++str++"$") 2.5
-
 instance Show SixelImage where
   show (SixelImage img) = img
 
@@ -95,7 +85,7 @@
 
 instance {-# OVERLAPS #-} ToSixel DynamicImage where
   toSixel dimg = toSixel $ convertRGB8 dimg
-  putSixel img = BC.putStr $ img2sixel $ convertRGB8 img
+  putSixel img = putSixel $ convertRGB8 img
 
 instance {-# OVERLAPS #-} ToSixel (Image PixelRGB8) where
   toSixel img = SixelImage (BC.unpack $ img2sixel img)
@@ -105,31 +95,11 @@
   toSixel = id
   putSixel img = putStr $ show img
 
-latexStr :: String -> Float -> String
-latexStr str size =
-  "\\documentclass[border=2pt]{standalone}"
-    ++ "\\usepackage{amsmath}"
-    ++ "\\usepackage{graphicx}"
-    ++ "\\usepackage{varwidth}"
-    ++ "\\begin{document}"
-    ++ "\\begin{varwidth}{\\linewidth}"
-    ++ "\\scalebox{"
-    ++ show size
-    ++ "}{"
-    ++ str
-    ++ "}"
-    ++ "\\end{varwidth}"
-    ++ "\\end{document}"
-
 instance ToSixel LatexStr where
-  toSixel (LatexStr str size) = unsafePerformIO $ do
-    withSystemTempDirectory "sixel" $ \dir -> do
-      writeFile (dir ++ "/sixel.tex") (latexStr str size)
-      (_,outlog,errlog) <- readProcessWithExitCode "pdflatex" ["-output-directory="++dir ,dir ++ "/sixel.tex"] ""
-      readProcessWithExitCode "convert" [dir ++ "/sixel.pdf", "-quality", "90", dir ++ "/sixel.png"] ""
-      readImage (dir ++ "/sixel.png") >>= \case
-        Left err -> error $ "can not read sixel.png. // " ++ errlog ++ " // " ++ outlog
-        Right img -> return $ toSixel img
+  toSixel str = unsafePerformIO $ do
+    latex2img str >>= \case
+      Left err -> error err
+      Right img -> return $ toSixel img
   putSixel img = putStr $ show $ toSixel img
 
 --  toSixel img = SixelImage (show (toSixelCmds img))
@@ -190,7 +160,9 @@
       return (fromIntegral len)
 
 -- | Display sixel image via ByteString
+-- 
 -- putStr of String is really slow on ghci. (Compiled version is not so slow.)
+-- 
 -- To improve perfomance of rendering on ghci, this function uses putStr of ByteString.
 putImage :: FilePath -> IO ()
 putImage file = do
diff --git a/src/Data/Sixel/Internal.hs b/src/Data/Sixel/Internal.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Sixel/Internal.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Data.Sixel.Internal where
+
+import Codec.Picture
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.ForeignPtr
+import Foreign.Ptr
+import System.IO.Temp (withSystemTempDirectory)
+import System.Process (readProcessWithExitCode)
+
+foreign import ccall "bufsize" c_bufsize :: CInt -> CInt -> IO CInt
+
+foreign import ccall "img2sixel" c_img2sixel :: Ptr () -> Ptr () -> CInt -> CInt -> IO CInt
+
+data LatexStr
+  = LatexStr
+      { toLatexStr :: String,
+        strSize :: Float
+      }
+  deriving (Eq)
+
+latex :: String -> LatexStr
+latex str = LatexStr str 2.5
+
+math :: String -> LatexStr
+math str = LatexStr ("$" ++ str ++ "$") 2.5
+
+latexStr :: String -> Float -> String
+latexStr str size =
+  "\\documentclass[border=2pt]{standalone}"
+    ++ "\\usepackage{amsmath}"
+    ++ "\\usepackage{graphicx}"
+    ++ "\\usepackage{varwidth}"
+    ++ "\\begin{document}"
+    ++ "\\begin{varwidth}{\\linewidth}"
+    ++ "\\scalebox{"
+    ++ show size
+    ++ "}{"
+    ++ str
+    ++ "}"
+    ++ "\\end{varwidth}"
+    ++ "\\end{document}"
+
+latex2img :: LatexStr -> IO (Either String DynamicImage)
+latex2img (LatexStr str size) =
+  withSystemTempDirectory "sixel" $ \dir -> do
+    writeFile (dir ++ "/sixel.tex") (latexStr str size)
+    (_, outlog, errlog) <- readProcessWithExitCode "pdflatex" ["-output-directory=" ++ dir, dir ++ "/sixel.tex"] ""
+    readProcessWithExitCode "convert" [dir ++ "/sixel.pdf", "-quality", "90", dir ++ "/sixel.png"] ""
+    readImage (dir ++ "/sixel.png") >>= \case
+      Left err -> return $ Left $ "can not read sixel.png. \n" ++ err ++ "\n" ++ errlog ++ "\n" ++ outlog
+      Right img -> return $ Right img
