Image enhancement is a crucial task in computer vision that aims to improve the quality of images and enhance visual elements, making them more informative and aesthetically pleasing. Generative Adversarial Networks (GANs) have emerged as a powerful tool in the field, showing promise in enhancing and restoring image quality. Despite their potential, GAN-based methods often face challenges such as instability, high computational costs, and the risk of generating unwanted visual artifacts that degrade the final image quality. To address these issues, this study introduces a novel architecture called ViTRA, which combines the capabilities of the Vision Transformer (ViT) with a Relative Positional Encoding (RPE)-based attention mechanism. The ViTRA architecture is integrated into the HVI-CIDNet framework, specifically within the Light Cross-Attention Block (LCAB). By incorporating RPE, the architecture is enhanced, leading to the creation of a new attention mechanism known as the Relative Light Cross-Attention Block (RLCAB). This innovation allows for more effective feature extraction and attention distribution across the image, resulting in better image enhancement and fewer artifacts. Additionally, ViTRA implements automatic loss function weight optimization using Comprehensive Learning Particle Swarm Optimization (CLPSO) which is designed to improve stability and efficiency during model training. Experimental results demonstrate that the ViTRA architecture significantly improves image quality in both qualitative and quantitative terms when compared to traditional GAN and transformer-based approaches. On various benchmark datasets, including the LOLv2-Syn dataset, ViTRA outperforms existing models across all test metrics. Specifically, it achieves a Peak Signal-to-Noise Ratio (PSNR) of 25.716, a Structural Similarity Index (SSIM) of 0.946, and a Learned Perceptual Image Patch Similarity (LPIPS) of 0.0446, highlighting its superior performance in producing high-quality images. This work establishes ViTRA as a promising solution for enhancing image quality, overcoming common limitations in GAN and transformer-based models, and providing a robust approach for future image enhancement applications.