반응형

이미지 파일을 어떻게 불러오는지에 따라 해상도가 다르게 적용될 수 있다.

 

Reindeer.png
0.08MB

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Image i = Image.FromFile("Reindeer.png");
            Bitmap b1 = (Bitmap)Bitmap.FromFile("Reindeer.png");
            Bitmap b2 = new Bitmap(Image.FromFile("Reindeer.png"));
            
            // 100 pixel 간격
            e.Graphics.DrawImage(i, 00);
            e.Graphics.DrawImage(b1, 1000);
            e.Graphics.DrawImage(b2, 2000);
 
            // 해상도 출력
            string str = string.Format("i: {0}X{1}, b1: {2}X{3}, b2: {4}X{5}", i.HorizontalResolution, i.VerticalResolution,
                b1.HorizontalResolution, b1.VerticalResolution, b2.HorizontalResolution, b2.VerticalResolution);
            e.Graphics.DrawString(str, Font, Brushes.Black ,100510);
        }
    }
}
 

 

같은 파일(Reindeer.png)을 세 가지 방법으로 불러와서 100 픽셀 간격으로 출력해 보자.

 

i, b1과 b2의 해상도가 다르다.

 

예상한 것과 다른 방식으로 출력된다. 다른 이미지 뷰어에 표시되는 사이즈와 동일한 방식은 b2다. i, b1은 약간 확대(96/72=1.3배) 되었다. 이미지 파일을 사용할 때는 어떤식으로 불러올지 잘 선택하자.

 

파일에 따라 어떻게 불러와도 같은 사이즈로 표시되기도 한다.

 

반응형
Posted by J-sean
:
반응형

2021.01.04 - [Linux] - Open Image Files From Terminal in Linux(Ubuntu) - 리눅스(우분투) 터미널에서 이미지 파일 열기

 

리눅스(우분투) 서버 같은 콘솔 환경에서도 이미지 뷰어를 사용할 수 있다.

 

fbi를 설치한다. fbi는 리눅스의 framebuffer를 이용해 이미지를 디스플레이한다. 

 

sudo fbi '이미지 파일' 형식으로 실행한다.

 

이미지가 디스플레이 된다.

 

h키를 누르면 keyboard commands를 볼 수 있다.

 

반응형
Posted by J-sean
:
반응형

보통 이미지 뷰어는 투명 영역을 체크무늬나 검정색으로 표시한다. 이미지의 투명한 영역이 투과되어 보이는 이미지 뷰어를 사용해 보자.


투명 배경에 흰색 글자가 표시되어 있다. 흰색 배경의 브라우저를 사용한다면 위 이미지가 보이지 않는다.


pqiv를 설치한다.


pqiv -c -i -P '50, 50' sean.png 명령을 실행한다. '&' 옵션을 주지 않아도 백그라운드로 실행된다.


-c, --transparent-background

Draw pqiv's window borderless and transparent. In window mode, a mouse click activates and deactivates window decorations.


-i, --hide-info-box

Initially hide the infobox. Whether the box is visible can be toggled by pressing 'i' at runtime by default.


-P, --window-position=POSITION

Set the initial window position. POSITION may either be 'x,y'  screen coordinates or 'off' to not position the window at all.


그 외 옵션은 Ubuntu Manpage를 참고하자.


반응형
Posted by J-sean
: