Web-Based Binary Image Compression Using Thresholding and Run-Length Encoding
DOI:
https://doi.org/10.65230/jitcos.v2i1.116Keywords:
Binary Image, Compression, Run-Length Encoding, Thresholding, Web-Based SystemAbstract
This study implements the Run-Length Encoding (RLE) algorithm for binary image compression in a web-based environment using thresholding as a preprocessing stage. The system was developed using JavaScript and the HTML5 Canvas API to perform grayscale conversion, thresholding, and image compression directly within a web browser. Thresholding was applied to transform RGB images into binary images with simpler and more repetitive pixel patterns suitable for RLE compression. The compression process encodes consecutive pixels with identical values into tuples consisting of run lengths and pixel values. Experiments were conducted using a test image and five threshold values (50,75,100,127,150) to evaluate their influence on compression performance. The results show that threshold selection affects pixel redundancy, the number of generated tuples, and compression efficiency. The highest performance was achieved at a threshold value of 127, resulting in storage savings of 63.6% and a compression ratio of 2.75:1. The findings indicate that RLE is effective for compressing binary images with repetitive pixel patterns. Furthermore, the RLE compression stage is lossless with respect to the binary image generated after thresholding, whereas the preprocessing stage from RGB to binary is lossy because color and intensity information are discarded.
References
Adillah, N., Nasution, Y. R., & Armansyah. (2023). Perbandingan Algoritma Run Length Encoding (RLE) dan Algoritma Variable Length Binary Encoding (VLBE) dalam Mengkompresi File Video Untuk Menghemat Penyimpanan. G-Tech: Jurnal Teknologi Terapan, 7(4), 1203–1212. doi: 10.33379/GTECH.V7I4.3020
Ambarita, C. N. (2024). Analisis Perbandingan Algoritma Run Length Encoding Dan Algoritma Five Modulus Dalam Kompresi File PDF. KETIK : Jurnal Informatika, 1(03), 76–87. doi: 10.70404/KETIK.V1I03.47
Angelita, A., & Rosandy, T. (2025). IMPLEMENTASI ALGORITMA RUN LENGTH ENCODING (RLE) UNTUK EFISIENSI PENYIMPANAN DATA TEKS BERBASIS PYTHON. Jurnal Mnemonic, 8(2), 266–270. doi: 10.36040/MNEMONIC.V8I2.14758
Apridiansyah, Y., Toyib, R., & Wijaya, A. (2022). Metode Otsu dan Mathematical Morphology Dalam Segmentasi Region Karakter Plat Nomor Kendaraan. Journal of Applied Computer Science and Technology, 3(1), 134–143. doi: 10.52158/JACOST.V3I1.277
Baso, B., Nababan, D., risald, R., & Kolloh, R. Y. (2022). Segmentasi Citra Tenun Menggunakan Metode Otsu Thresholding dengan Median Filter. JURNAL TEKNOLOGI DAN ILMU KOMPUTER PRIMA (JUTIKOMP), 5(1), 1–6. doi: 10.34012/JUTIKOMP.V5I1.2586
Bastian, A., Mardiana, A., Berliani, M., & Firmansyah, M. B. (2023). Run Length Encoding Compresion on Virtual Tour Campus to Enhance Load Access Performance. Jurnal Online Informatika, 8(1), 27–35. doi: 10.15575/JOIN.V8I1.1000
Bharath, K. N., Babu, K. S., & Ravi, V. (2024). Security of Magnetic Resonance Medical Images using Region-based Lossless Image Compression in Healthcare Information Systems. The Open Public Health Journal, 17(1). doi: 10.2174/0118749445326668240801105910
Cahayati, D., Pardede, A. M. H., & Khair, H. (2022). Implementasi Algoritma Elias Gamma Kompresi Pada File Teks. ALGORITMA: Jurnal Ilmu Komputer Dan Informatika, 06, 159–166. Retrieved from https://jurnal.uinsu.ac.id/index.php/algoritma/article/viewFile/11867/5412
Dewi, G. (2024). Pengolahan Citra Untuk Mengetahui Tingkat Perubahan Noise Pada Media Penampung Air Menggunakan Metode Histogram Citra. Bulletin of Data Science, 3(2), 176–184. doi: 10.47065/BULLETINDS.V3I2.6286
Fakhrurrozy Cahyadi, M., Syahputra, S., Syari, M. A., & Kaputama, S. (2022). Penerapan Metode Thresholding Pada Proses Transformasi Citra Digital. Educate: Jurnal Ilmu Pendidikan Dan Pengajaran, 1(3), 319–346. doi: 10.56114/EDU.V1I3.422
Hadikusuma, R. S., & Rahmadewi, R. (2023). ANALISIS TRANSMISI DATA CITRA DIGITAL ESP 32 CAM PADA PROTOTIPE ROBOT PEMADAM API MENGGUNAKAN METODE KOMPRESI CITRA MJPG. Barometer, 8(1), 1–8. doi: 10.35261/BAROMETER.V8I1.6401
Hidayat, J., & Syafriwel, S. (2022). Implementasi Metode Otsu Thresholding Pada Binerisasi Citra Wajah. JURNAL PERSEGI BULAT, 1(1), 1–6. doi: 10.36490/JURNALPERSEGIBULAT.V1I1.246
Hu, P., Han, Y., Zhang, Z., Chu, S. C., & Pan, J. S. (2024). A multi-level thresholding image segmentation algorithm based on equilibrium optimizer. Scientific Reports 2024 14:1, 14(1), 29728-. doi: 10.1038/s41598-024-81075-w
Li, J., & Gui, X. (2024). Fully Automatic Grayscale Image Segmentation: Dynamic Thresholding for Background Adaptation, Improved Image Center Point Selection, and Noise-Resilient Start/End Point Determination. Applied Sciences 2024, Vol. 14, Page 9303, 14(20), 9303. doi: 10.3390/APP14209303
Marpaung, P., Jannah, M., & Sinaga, B. (2025). Implementasi Metode Thresholding Dalam Mengenali Bentuk Citra Buah Salak. Jurnal Media Informatika, 6(3), 2227–2235. doi: 10.55338/JUMIN.V6I3.6487
Parfieniuk, M., Nowosielski, A., Erdal, E., & Önal, A. (2025). Enhanced Framework for Lossless Image Compression Using Image Segmentation and a Novel Dynamic Bit-Level Encoding Algorithm. Applied Sciences 2025, Vol. 15, Page 2964, 15(6), 2964. doi: 10.3390/APP15062964
Peng, X., Zhang, Y., Peng, D., & Zhu, J. (2023). Selective Run-Length Encoding. Data Compression Conference Proceedings, 576. doi: 10.1109/DCC58796.2024.00093
Prayoga, F., Aulia Meliala, N., Khalil Gibran, M., & Muhammad Zikri Fadillah, O. (2024). Perancangan Sistem Informasi Pendaftaran Kerja Praktik Berbasis Web Pada Dinas Pekerjaan Umum dan Penataan Ruang Dengan Menggunakan Metode Prototype. Jurnal Multimedia Dan Teknologi Informasi (Jatilima), 6(03), 39–48. doi: 10.54209/JATILIMA.V6I03.940
Romegar Mair, Z., & Rahmanda, A. (2025). Perbandingan Versi Terbaik YOLO Dalam Mendeteksi Jarak Spasi Antar Baris Tulisan Tangan. Jurnal Sains, Nalar, Dan Aplikasi Teknologi Informasi, 4(2), 103–110. doi: 10.20885/SNATI.V4.I2.40414
Simarmata, A. M., Zizwan Putra, A., & Mahmud Husein, A. (2023). Penerapan Metode Computer Vision Dalam Klasifikasi Buah Jeruk Menggunakan Teknik Image Pre-Processing. Data Sciences Indonesia (DSI), 3(2), 42–48. doi: 10.47709/DSI.V3I2.4010
Siradjuddin, H. K., Khairan, A., Ridha Albaar, M., & Abdullah, S. Do. (2024). Implementasi Algoritma Run Length Encoding (RLE) Pada Kompres Data Teks menggunakan Python Implementation of Run Length Encoding (RLE) Algorithm on Text Data Compress using Python. Sistemasi: Jurnal Sistem Informasi, 13, 1510–1517. Retrieved from http://sistemasi.ftik.unisi.ac.id
Siregar, K. (2023). DIGITAL IMAGE COMPRESSION USING RUN LENGTH ENCODING METHOD. BIOS: Jurnal Informatika Dan Sains , 1(01), 20–24. Retrieved from https://seaninstitute.or.id/bersinar/index.php/bios/article/view/16
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Adli Rahman Harun Harahap, Fazila Nazifa Edilia, Andita Utami, Zianah Nafisah Simbolon, Faiz Akhtar Aqila (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.









